i do 2 different ajax request via jQuery and i have to check the other one is active or not. How can i do that ?
one of example from my ajax requests:
active_project_categories_ajax = $.ajax(
{
url: "/ajax/get_skill_list",
dataType: 'json',
......
});
i need something like that: active_project_categories_ajax.status()
since you are getting back the XMLHttpRequest object, you can always look at
the readyState needs to be 4 for it to be completed (success or error). so if it is less than 4, then it is still active.
this is the readyState:
quoted from: http://www.w3.org/TR/XMLHttpRequest/#the-xmlhttprequest-interface
You cannot look at the status before readyState becomes 4. otherwise there may be an exception raised. (actually, i wrote a php file that return 1MB of data… and when the readyState was 3, the status was also 200. i suspect the status would be 200 if the readyState stopped at 2 as well).