Say I have this code:
function onComplete(event, request, settings)
{
// How do I get the data? In the correct format?
}
$('body').ajaxComplete(onComplete);
In regular ajax success handlers, I can just access the data directly since it will be the first parameter to the handler. It will also be in the correct format (as long as the content-type was set right on the server).
How do I deal with the data on the ajaxComplete event?
You can use it like this, but it’s not documented:
The
jQuery.httpDatafunction is what’s used internally to getdatafor thesuccesshandler, but you can use it directly. Please be aware that it is undocumented, and therefore subject to change without notice in new releases. For example in jQuery 1.4.3, it will bejQuery.ajax.httpDatainstead.