I have my code like this for geetting the value of the variable isItemLocked.
function authorItem(itemNumber){
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
url ="Some URL";
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
var isItemLocked = xmlhttp.responseText;
if(isItemLocked){
alert('Item has been Closed.Click OK to go to Search Page');
window.location = "SOME OTHER URL";
}else{
var url ="SOME OTHE URL 1";
location.href = url;
}
}
}
}
A returnning boolean value true for isItemLocked.But each time I am going to SOME OTHER URL.Any solutions?
xmlhttp.responseTextdoesn’t return a boolean, it returns a string and"false"istrue.Perform a string comparison.