I cannot seem to set the value of count even though it is global to the function. please help.
function isSpecBook(fileid)
{
var count = 0;
if (window.XMLHttpRequest) {
var req = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
var req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("GET", "isSpecBook.php?FileID="+fileid+"&json=1", true);
req.setRequestHeader('Content-Type', 'application/json');
req.send(null);
req.onreadystatechange = function() {
if ((req.readyState == 4) && (req.status == 200)) {
var jsonSpec = eval('(' + req.responseText + ')');
count =1;
}
}//req.onreadystatechange = function() {
alert(count);//count outside function
}//function