Home Forums General XMetaL Discussion Asynchronous JavaScript? Reply To: Asynchronous JavaScript?

sajoss

Reply to: Asynchronous JavaScript?

xmlhttp = new ActiveXObject(“MSXML2.XMLHTTP.6.0”);  // code for IE6, IE5 or XMetaL
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
//async code in here
var response = xmlhttp.responseText;
var json = JSON.parse(response);
}
}
xmlhttp.open(“POST”, url, true);
xmlhttp.setRequestHeader(“content-type”, “application/json”);
xmlhttp.send(params);

this works for me but you may want to consider timeouts etc. if you cannot reach the server and also handling some other status although you will get no headers in Xmetal until you reach a readystate of 4 afaik. (I have been having a long painful journey with http requests in Xmetal)

Reply

Products
Downloads
Support