Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

i have struggled with one problem.
ajax call with jquery for webservice working fine in ie but not working in googlechrome, firefox,safari.

in googlechrome,safari and firefox it gives response as undefined

this is my code..

in aspx page
JavaScript
$.ajax({
                type: "POST",
                url: "xxx.svc/logindetails",
                contentType: "application/json",
                data: '{ "UserName": "' + UserName + '","Password": "' + Password + '"}',
                async: false,
                success: function (data) {
                    if (data.text == '') {
                       // xxxxxxxxx  
                    }
                    else{//redirect}
},
                error: function (data) {
                    //alert();
                }
            });


in xxx.svc:


C#
OperationContract]
        [WebInvoke(Method = "POST",
            BodyStyle = WebMessageBodyStyle.WrappedRequest,
            ResponseFormat = WebMessageFormat.Xml
        )]
public string GetUserDetailsbyLogIn(string UserName, string Password)
        {
string msg="";
// checking user exist or not
           return msg;
}

anyone can know about this pls help me
thanks in advance...
Posted
Updated 14-Nov-12 21:35pm
v2
Comments
n.podbielski 15-Nov-12 3:33am    
So how do you know that it is not working? Any errors?
n.podbielski 15-Nov-12 3:36am    
Also please format your question better next time.

1 solution

I think problem lies in Accepts an Content-Type HTTP headers.
Please see my edited answer here, and try if this will work.
http://stackoverflow.com/questions/13246023/unable-to-parse-the-json-returned-by-the-server-youre-trying-to-decode-an-inva/13246219#13246219[^]
 
Share this answer
 

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