Forum Moderators: open
xmlhttp.open('GET', myurl, true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
var content = xmlhttp.responseText;
if ( content!= 'err' )
document.getElementById('fbbox').innerHTML = content;
else
document.getElementById('fbbox').innerHTML = 'There was an error';
}
}
How might I do a POST rather than a GET, and set the fields?
This is the code I have been using, does 'get' or 'post', iDataS are the arguments to be posted NOT part of iUrlS
I have a far more comprehensive solution, but I'm not allowed to post a link to it here, and it's too much code to post.
It's basically a full "AJAX Queue Class", handling things like pipelining and selecting the HTTPRequest phase of the callback.
One thing that I do is take a full URI, with the standard question mark/ampersand format, and make a POST query from it, if that is what you want. The calling context doesn't have to worry about doing anything more than setting a flag. I'm pretty sure I took the technique directly from some samples out there.
[edited by: DrDoc at 10:26 pm (utc) on Sep. 23, 2006]
[edit reason] TOS #13 [/edit]
[edited by: DrDoc at 11:05 pm (utc) on Sep. 23, 2006]
[edit reason] properly linked [/edit]