Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi ,


I am new to jquery ..my service is not calling .i dono how to resolve this.

Any one can help me out


Regards,
gayathri reddy

What I have tried:

$(document).ready(function () {

$('#btnSubmit').click(function (event) {
debugger
var url = "http://localhost:35013/UserService.svc/ValidateUser/" + $('#sender-email').val() + "/" + $('#user-pass').val();

$.getJSON(url, function (data) {
if (data.ValidateUserResult.length > 0) {
alert("logged in");
}
});
});
});


[ServiceContract]
public interface IUserService
{
[OperationContract]
[WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "ValidateUser/{LoginID}/{Password}")]
User ValidateUser(string LoginID, string Password);

}



[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class UserService : IUserService
{
public User ValidateUser(string LoginID, string Password)
{
Membership.ValidateUser(LoginID, Password);
User _obj = new User();
_obj.LoginID = LoginID;
return _obj;
}
}
Posted
Updated 24-Jun-16 22:24pm
v2
Comments
Karthik_Mahalingam 25-Jun-16 2:52am    
What is the error message ?
Gayathri Reddy 25-Jun-16 5:10am    
Hi karthik,


it is not showing any defects exactly..Thanks for the reply. i got the result.
The problem is if (data.ValidateUserResult.length > 0)
condition only.it was not working .i found it.if any clarification in future i will get back you. Thank you


regards

gayathri reddy
Karthik_Mahalingam 25-Jun-16 5:18am    
Sure. Cool
Gayathri Reddy 25-Jun-16 5:23am    
:-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900