Click here to Skip to main content
12,454,104 members (57,112 online)
Rate this:
 
Please Sign up or sign in to vote.
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
$.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:


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 14-Nov-12 0:32am
agarmt491
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 15 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100