Menu
When using the $.ajax() function for sending a request for information from server-side scripting, can you pass parameters to the callback function?
Example – How can I accomplish something like this?
this.request = function(phpURL, arrayToUse, firstTime, startPos, callback){
$.ajax({
type: “POST”,
url: phpURL,
data: buildParameters(firstTime, startPos),
dataType: “xml”,
success: callback(data, arrayToUse)}
});
}
Please note: Taking out ‘arrayToUse’ from ‘callback(data, arrayToUse)’ works.
Thanks,