let xhr = new XMLHttpRequest; //Call the open function, GET-type of request, url, true-asynchronous xhr.open('GET', 'http://localhost:51574/api/My/logindata?unm=RSB&pwd=1235', true) //call the onload xhr.onload = function() { //check if the status is 200(means everything is okay) if (this.status === 200) { //return server response as an object with JSON.parse alert("OK"); console.log(JSON.parse(this.responseText)); } } //call send xhr.send(); //Common Types of HTTP Statuses // 200: OK // 404: ERROR // 403: FORBIDDEN