Hi:
I’m using Matt Kruse’s AjaxRequest library. I highly recommend it, but
am unexperienced with Ajax in general, and I note that his own forum
is not longer accessible.
I’m including a piece of code that I wrote using his library. It works, does
what I need it to do, but I can’t figure out how to get the responseText
member without first writing to a document hidden field and then retrieving the value.
It would be nice if I could access it directly. I.E. assign directly to a local javascript variable.
Any clues would be appreciated.
Thanks.
[code]
function UpdateHits(mlsNum){
var domain = document.domain;
var targets = new Array();
targets[“bart.johnson.com”] = ‘http://bart.johnson.com/cgi-bin/baker/AjaxUpdater.py’;
var target = targets[domain];
// Retrieve the response text via DOM from hidden input field
var response = document.forms[“getresponse”].response.value;
AjaxRequest.get({
‘url’:target, // CGI to query
// Write response text to a DOM member
‘onSuccess’:function(req){document.forms[‘getresponse’].response.value = req.responseText; },
‘onError’:function(req){ alert(“ERROR: ” + req.statusText);},
‘parameters’:{‘mls_no’:mlsNum,’ajax’:1,”test”:”from tim”},
});
alert(‘response: ‘ + response); //debug – yup, there it is, in a round-about fashion
}