AJAX and ARMweb

Questions about the BASICtools and MakeItC
Post Reply
YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

AJAX and ARMweb

Post by YahooArchive »

Anyone have any success with AJAX on the ArmWEB? I didn't see anywhere that it
is supported, but I gave it a try and I got some joy but I never get to the
"XMLHttpRequestObject.status == 200". I am wondering if I am spinning my wheels
are not.

Thanks - Jim



YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: AJAX and ARMweb

Post by YahooArchive »

Yes I've used it successfully, are you using it asynchronously?

Example:

var req = new XMLHttpRequest;
req.open("GET", url, true); // true for last param = async
req.onreadystatechange = rsc; // rsc is a function
req.send();


function rsc()
{
if (req.readyState != 4)
return;

// check status and process returned data
}


-MM

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: AJAX and ARMweb

Post by YahooArchive »

I forgot to mention, in IE (at least) the response will cache. To defeat that I
tack-on a unique value as a dummy parameter.


-MM

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: AJAX and ARMweb

Post by YahooArchive »

Yes, I am using asynch, but my code was a bit more complicated, I was sending
some header content stuff and I was doing a POST (I lifted the code from a
previously working project). I will try the example you gave and see how that
flies (also working on using an iframe, but will go back to ajax if I can get it
to work).


Thanks - Jim

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: AJAX and ARMweb

Post by YahooArchive »

POST is only allowed for loading code into the built-in basic compiler.

User code should use GET which supports extended url armweb.html?this=that

Post Reply