Thursday 24 April 2014

Ajax readystate issues

Posted by Саша 20:43, under | No comments


Ajax readystate issues? Ajax readystate issues?

req = new XMLHttpRequest();

req.onreadystatechange = processReqChange(what);

req.open('POST', url, true);



function processReqChange(what) {

alert(req.readyState); <------------------------COMING OUT TO BE 0



// only if req shows 'loaded'
if (req.readyState == 4) {
// only if 'OK'
if (req.status == 200) {
alert(what);
eval(what);
} else {
alert('There was a problem retrieving the XML data: ' +
req.responseText);
}
}
}














0 коммент.:

Post a Comment