Dev-folks,
I have the following *.
js file. Can anyone explain to me why my readyState is always 1 in the validate(...) fxn? Shouldn't it be 2? I have a WebApp running on Glassfish. I can provide more details upon request. Thanks.
[snippet]
// creating the XMLHttpRequest obj on Microsoft browsers
var xmlHttp = false;
// set initial focus on subscription id field on page load
function startup() {
document.forms[0].subscriptionID.focus();
}
function validate (formObj) {
init();
xmlHttp.onreadystatechange = subscriptionValidator;
xmlHttp.send("subscriptionID="+formObj.subscriptio nID.value);
alert("readyState = " + xmlHttp.readyState);
}
function init() {
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
@end @*/
if( !xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest();
}
var url = "/BookServlet";
xmlHttp.open("POST", url, true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
}
[/snippet]