Home » Javascript » I am getting server response in Dreamweaver but not in the browser

I am getting server response in Dreamweaver but not in the browser

Posted by: admin November 1, 2017 Leave a comment

Questions:

This is my script that is being used in the html file. User Login is the function which is being called when the button is clicked. I am getting XMLhttpRequest response in Dreamweaver but not in google chrome or any other Browser.

    <script>
   function userLogin() {
    var useremail = (document).getElementById("emailId").value;
    var localPassword = (document).getElementById("password").value;
    var http = new XMLHttpRequest();
    var url = "https://shivkantdohaliya.000webhostapp.com/Nineleaps/login.php?useremail="+useremail;
    //var params = "[email protected]";
    http.open("GET", url, true);
    http.onreadystatechange = function() {
       if(http.readyState == 4 && http.status == 200) {
        var result = JSON.parse(http.responseText);
        alert(result.status);
       }
   }

   http.send();
   }
   </script>
Answers: