I have tried with this code. But it is not working. I just need to return state of bool value. But always this returns `true`.

```
function nic_is_exist(){

  var state = true;
  var nic = document.getElementById("tbNic").value;
  var xmlhttp;
  if (window.XMLHttpRequest){
    xmlhttp=new XMLHttpRequest();
  }else{
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  } 
  xmlhttp.onreadystatechange=function(){
    if(xmlhttp.readyState == 1){
      document.getElementById("spNic").innerHTML="<img src='../Style/images/loarding.gif' />";  
    }     
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
      document.getElementById("spNic").innerHTML="";
      var str = xmlhttp.responseText;
      alert(str+2);
      if( str != "1"){
        alert("if");
        fill_form(str);
        checkNull();
        state = true;   
      }else{
        alert("else");
        state = false;
      }       
    }     
  }
  xmlhttp.open("POST","rpoRegister_PHP.php?a="+nic,true);
  xmlhttp.send();
  return state;
}

```