I am working on phonegap app. I need to validate user through .net webservice. I am using ajax to validate and parsing it through javascript.but i am stuck at readystate as it always return zero. I tried many things from available solutions I found in net but I don’t get it right.
Here is my Javascript:
username = 'ksl';
password = 'ksl';
var soapMessage =
'<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> \
<CheckLogin xmlns="http://tempuri.org/"> \
<UserName>' + username + '</UserName> \
<Password>' + password + '</Password> \
</CheckLogin> \
</soap:Body> \
</soap:Envelope>';
$.ajax({
url: validationURL,
type: "POST",
dataType: "xml",
data: soapMessage,
success: validate,
contentType: "text/xml; charset=\"utf-8\"",
error: function(xhr,status,error)
{
alert("state is:" + xhr.readyState);
}
});
return false;
and here is my webservice response:
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<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>
<CheckLoginResponse xmlns="http://tempuri.org/">
<CheckLoginResult>string</CheckLoginResult>
</CheckLoginResponse>
</soap:Body>
</soap:Envelope>
any response will be helpful
Ok..I found the problems::
1) there was space after
</soap:Body> \so I removed that.2) I made some changes in html and it works fine..
Thanks for having look at my problems..