Reputation: 53396
given an ajax callback like for example...
function showResponse(responseText, statusText, xhr) { }
How can I get a status/reponse code or something from the xhr
object?
alert(xhr); // [object]
alert(xhr.status); // undefined
alert(xhr.statusText); // undefined
Upvotes: 2
Views: 4929
Reputation: 470
You could use dojo framework and then output the xhr object with
console.dir(xhr)
Otherwise you could print all elements from xhr object with a for each loop
for (var n in xhr) {
alert(n + " => " + xhr[n]);
}
Note that i dont try this code so the code could include a bug ;-)
Upvotes: 1