Suppose I have a loop in which I call WinJS.xhr() on multiple addresses. In the response handler, is there a way to determine the address from which the response is being handled? Either by discerning it from the XmlHttpRequest object that xhr() passes to the handler or by passing something else in manually?
I’ve been looking through the documentation as well as examining the response in the debugger but haven’t been able to find anything.
I don’t think that information is in the response, but it doesn’t need to be. Every xhr call has its own Promise that is returned for that specific call. I like to do it this way…
And then you can loop the results array and you have the url. You might want to wrap that in another promise so the whole thing is asynchronous.
Hope that helps!