locked
winjs.xhr doesn't call 'complete' function

    Question

  • Hello

    I have this line to get data from my web server on localhost:

    WinJS.Promise.timeout(5000, WinJS.xhr({ url: url  }).then(xhrParseJson, xhrError));

    I can see in Fiddler that the server returns the appropriate json. However, if I set a breakpoint in the xhrParseJson function and another in the xhrError function, neither is hit. Execution just jumps straight over those two functions.

    I have pretty much exactly the same code in an earlier part of my app and that works fine.

    Any ideas?

    Thanks,

    Mick


    • Edited by munder Sunday, January 20, 2013 12:48 PM
    Sunday, January 20, 2013 12:41 PM

Answers

  • My apologies for asking a stupid question. It looks like I should have chained the execution of the rest of my code by adding another .then() to the end of the promise. Caught out by asynchronicity yet again. 
    • Marked as answer by munder Sunday, January 20, 2013 1:29 PM
    Sunday, January 20, 2013 1:29 PM