window.location is not working javascript

93 Views Asked by At
function showMessage()
{
  var num=new Array('25926419','9920084590','9867988449','28758869','28521181');
  var contact= document.getElementById('contact').value;
  if (num.indexOf(contact) > -1) 
  {
    window.location='address-directory.php';
  } 
  else
  {
    document.getElementById('errordiv').innerHTML="you are not allowed to see Member Details";
    $("#myModal").modal('show');
    return false;
  }  
}

window.location is not working in this function i want to redirect it on another page

1

There are 1 best solutions below

0
On
function showMessage()
{
  var num=new Array('25926419','9920084590','9867988449','28758869','28521181');
  var contact= document.getElementById('contact').value;
  if (num.indexOf(contact) > -1) 
  {
    window.location='address-directory.php';
  } 
else
 {
     document.getElementById('errordiv').innerHTML="you are not allowed to see Member Details";
 $("#myModal").modal('show');


}
 return false;

}

its working now... i wrote return false in else part previously..............