I want to use jQuery to call a asmx web service to validate user logins. The Ajax call is successful but I don’t get any results. Can anyone help to find where the problem is?
Here is the web service:
http://54.245.105.127/UACServices/GSaaS.asmx?op=validateUser
Here is the code for the call:
$('#loginForm').submit(function(e) {
e.preventDefault();
var username = $('input[name="username"]').val();
var password = $('input[name="password"]').val();
var tablename = "tbl_CODNRUSERS";
var userInfo = '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><validateUser xmlns="http://tempuri.org/"><username>'
+ username + '</username><password>'
+ password + '</password><tablename>'
+ tablename + '</tablename></validateUser></soap:Body></soap:Envelope>';
$.ajax({
url: "http://localhost/UACServices/GSaaS.asmx?op=validateUser",
type: "POST",
contentType: "text/xml; charset='utf-8'",
data: userInfo,
success: function(data) {
console.log(data);
},
error: function(errMsg)
{
console.log("error: " + errMsg);
}
});
return false;
});