The JQuery PHP Library creates an object $.php which works similarly to $.ajax. like this:
$.php(url);
php.complete = function (){
$('#loading').slideUp('slow');
}
… by doing so it adds a whole bunch of functionality which lets you do jQuery-y stuff from the server. But I don’t like how the complete function works. I’d prefer this:
$.ajax(url)
.complete(function() {
$('#loading').slideUp('slow');
});
… The difference is that I want to have a custom complete handler for each separate call. The way it is now, if I use jQuery PHP and do a second $.php call and define a php.complete handler, the new php.complete handler will overwrite the first.
Does a solution like this already exist? If not, how would one go about modifying the jQuery PHP library to make it function this way?
NOTE: In jQuery 1.8+ complete() is deprecated in favor of always()
Modify line 19 to return the jqXHR object from the method.
http://pastebin.com/tCzMBGtD
becomes