I'm writing a jQuery plugin where I need to use an $.ajax request and to handle the callback with additional parameter but I find it very difficult to implement it.
a semplified version:
$('#element_id').click (function () {
var additional_params = { name:'mike', surname:'buongiorno' };
var ajax_params = {
type: "POST",
url: "some.php",
data:'data here',
complete:getResponse
}
sendAJAX (ajax_params, additional_params);
});
var sendAJAX = function (ajax_params, additional_params) {
$.ajax(ajax_params, additional_params);
}
var getResponse = function (data, additional_params) {
}
Does exist some way to do something like this to pass additional_params to complete callback function (in this case getResponse)?