خرید بک لینک

Vote count: 0

Used specs: HTML5, Javascript

My question is as follows, I am trying to make a put request to the api from Phillips HUE and I found the following method of adding $.put to Jquery:

$.put = function(url, data, callback, type){

 if ( $.isFunction(data) ){
    type = type || callback,
    callback = data,
    data = {}
  }

  return $.ajax({
    url: url,
    type: 'PUT',
    success: callback,
    data: data,
    contentType: type
  });
}

My javascript file will get multiple methods and I want to know where I have to add this code so it will work in all my methods. Can I make a method that runs before all others and adds $.put to my JQuery for all methods or do I have to put this block of code inside every method?

Thanks in advance for your answers!

Greetings, Chiel

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 13 ارديبهشت 1396 ساعت: 7:58

صفحه بندی