Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Developing Windows Store Apps with HTML5 and JavaScript

You're reading from   Developing Windows Store Apps with HTML5 and JavaScript The Windows store is growing in popularity and with this step-by-step guide it's easy to join the bandwagon using HTML5, CSS3, and JavaScript. From basic development techniques to publishing on the store, it's the complete primer.

Arrow left icon
Product type Book
Published in Aug 2013
Publisher Packt
ISBN-13 9781849687102
Pages 184 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Rami Sarieddine Rami Sarieddine
Author Profile Icon Rami Sarieddine
Rami Sarieddine
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Developing Windows Store Apps with HTML5 and JavaScript
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1. HTML5 Structure FREE CHAPTER 2. Styling with CSS3 3. JavaScript for Windows Apps 4. Developing Apps with JavaScript 5. Binding Data to the App 6. Making the App Responsive 7. Making the App Live with Tiles and Notifications 8. Signing Users in 9. Adding Menus and Commands 10. Packaging and Publishing 11. Developing Apps with XAML Index

Understanding WinJS.xhr


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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime