December 2013
Intermediate to advanced
480 pages
14h 11m
English
The XmlHttpRequest object—and therefore, the WinJS.xhr() function—can be used to return several different types of data including blobs, documents, and text. You can use the responseType option to specify how you want the data returned.
The default value of responseType is text. For example, the following request will return the contents of the XML feed as a string:
var options = { url: "http://stephenwalther.com/feed"};WinJS.xhr(options).done( function (xhr) { var result = xhr.response; // xhr.response is a string });
Most likely, you don’t want to return an XML document as a string because then you can’t use methods like querySelector() and querySelectorAll() ...
Read now
Unlock full access