-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Developing Windows Store Apps with HTML5 and JavaScript
By :
The xhr function basically wraps the calls to XMLHttpRequest in a Promise object. The function is useful for cross-domain and intranet requests, as shown in the following code:
WinJS.xhr(options).then(
function completed(result) {
….
},
function error(result) {
….
},
function progress(result) {
….
},Since the WinJS.xhr function processes asynchronously and returns a Promise object, we can pass the then() or done() method to it, as shown in the previous example.
You can use the WinJs.xhr function to connect to a web service and to download different types of content, such as text or a JSON string that are specified in the responseType option of WinJS.xhr. The responseType option takes a string value that specifies the type of response expected from the request, and the types are as follows:
text: This is the default value and expects a response of type string
arraybuffer: This expects an ArrayBuffer used to represent binary content such...
Change the font size
Change margin width
Change background colour