My html page call a cgi program using XMLHttpRequest, if I define method synchronous, I receive the server answer (from iSeries v5r4) and the program works, if I define method asynchronous I don't receive the server answer (onreadychange never change)
Someone can help me?
This is the code:
Someone can help me?
This is the code:
PHP Code:
<script language=javascript>
function elabora() {
pgmtocall = '/cgigrp/vg24rh0a.cgi';
stringpar = 'cgcod=' + document.getElementById("cgcod").value;
if (window.XMLHttpRequest){
var client = new XMLHttpRequest();
}
else {
var client = new ActiveXObject("Microsoft.XMLHTTP");
}
client.open("POST",pgmtocall,true);
client.onreadystatechange = testfine(client);
client.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
client.send(stringpar);
}
function testfine(client) {
if (client.readyState == 4) {
if (client.status == 200) {
document.getElementById("report").value = codreport;
}
}
}
</script>
Comment