سؤال

I'm using WinJS.xhr to call a ReST service... when I call the url on the browser I can see the complete returned xml. So I want to parse that xml to show some of the data.

WinJS.xhr({ url: "http://myserver/myservice" }).
    then(processPosts, downloadError);

The problem is my downloadError function does not have parameters so I have no idea what went wrong.

What am I missing?

The help page is not very helpful :(

Edit: I used to fiddler to see what's on the wire and I don't see the request. The server I'm targeting is my own LAN, I also tried with its IP Address with same results (none)

هل كانت مفيدة؟

المحلول

When there is an error the callback function will take one parameter. The downloadError will need to take in one parameter. If you define downloadError as follows you should get more details. The result type should be XMLHttpRequest and using that you can see the status of the request and why it failed.

function downloadError(result){
//check the result param.
}

EDIT:

Check the app capabilities in your application.AppManifest file. The capabilities section is where you define what capabilities are required by your app for example connect to the internet, use the webcam.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top