0 votes
in AJAX by
How would you identify the completion of Ajax’s request?

1 Answer

0 votes
by
In order to complete the Ajax request, the condition should be as below:

ReadyState property that defines current state of XMLHttpRequest if equals to four (xmlhttp.readyState == 4 && xmlhttp.status ==200) then data is available and Ajax request will be complete.

Code snippet:

xmlhttp.onreadystatechange = function()

{ if (xmlhttp.readyState == 4 && xmlhttp.status == 200)

{

//Ajax request will be complete if above conditions are satisfied

}

}
...