working with WinJS.xhr

Sep 5, 2014 at 9:07 AM
IS there any way to bind ASP.NET_sessionID in the two winjs.xhr .
WinJS.xhr(url:"example.aspx"){
    
}.then(function(){
    // retrieve the captcha from a .aspx webpage
});

WinJS.xhr(url:example.axpx){
// submit  captcha and the username and some other information .    
 data: somedata
    
}.
then (function(){
     // getting the response back .
});

Actually i 'm using winjs in multi-device-hybrid-app extension so using Windows * API will not make any sense . I want to make my app crossplatform.
Sep 8, 2014 at 10:16 PM
I believe that question suits better the winjs github page.
https://github.com/winjs/winjs
Coordinator
Sep 9, 2014 at 7:04 AM
I think the fundamental question you're asking is about chaining asynchronous events, and that can be achieved with something like this...
myAsyncFunction1()
    .then(function(result1) {
        //do something with result1
        return myAsyncFunction2();
    }
    .then(function(result2) {
        //do something with result2
        return myAsyncFunction3();
    }
    ...
But actually, I don't think you need chaining in your example. You are going to fetch something from example.aspx and then (in the .then function) you are going to show the captcha... enabling the user to enter the result. The user clicking submit on the captcha is going to trigger a new (perhaps asynchronous) event, but it doesn't not at all need to be tied to the first one. You just know it will happen after because the captcha is not even available until your first call comes back and you show it.
Sep 9, 2014 at 8:28 AM
Actually i want to programmatically submit form to a webpage.
(http://result.rgpv.ac.in/exam/BHY_Result.aspx))

so in one XHR call i will retrieve Captcha from this webpage and after the user enter the captcha along with his roll no and semester .. in the second XHR call i will submit this information back to the webpage ,But as i post data to this website what i got is an error that u had entered the wrong captcha(text) .



In case u need sample roll no to check u can use it on the above link ..

Enrol: 0707PY111021

sem : 6
Coordinator
Sep 9, 2014 at 8:51 AM
I don't think I have enough information, but it doesn't sound like an issue I'd have time to troubleshoot for you anyway. Look closely at the actual requests and responses that are going out and coming back and see what difference there might be from what happens when you do it manually (I'm assuming it works when you do it manually). I would use Fiddler to capture the manual and automated attempts so I could directly compare the raw requests and responses.
Sep 9, 2014 at 9:21 AM
Edited Sep 9, 2014 at 9:23 AM
I had already inspect request and response using Httpfox and what that website gives me is a ASP_netSessionID along with google analytics cookie but unfortunately that Session ID has no relation with the Captcha code .....so is there any another approach to do that ....