How to process response data in ajaxComplete event

Let's 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 simply access the data directly, as this will be the first parameter for the handler. It will also be in the correct format (if the content type was installed directly on the server).

How do I process data in an event ajaxComplete?

+3
source share
3 answers

You can use it like this, but this is not documented:

function onComplete(event, request, settings) {
  var data = $.httpData(request, settings.dataType, settings);
}

jQuery.httpData function - , , data success, , , . , jQuery 1.4.3 jQuery.ajax.httpData.

+4

:

http://api.jquery.com/ajaxComplete/

, , . , set success Ajax.

0

, , ( ), AJAX .

To get to your data, you may need to navigate your approach more and use the call to $ .ajax () or one of its options, for example $ .get () or $ .getJSON (). See here

0
source

Source: https://habr.com/ru/post/1752445/


All Articles