javascript - Calling webservice method through ajax -
i have wcf service method:
[webinvoke(method = "post", uritemplate = "validatelogin", responseformat = webmessageformat.json,requestformat=webmessageformat.json,bodystyle=webmessagebodystyle.bare)] [operationcontract] bool validatelogin(login objlogin);
i calling method through phonegap code ajax as:
var parameters = { "emailid": emailid, "password": password }; $.ajax({ url: "http://localhost:95/mobileecomm/service1.svc/validatelogin", data: json.stringify(parameters), contenttype: "text/xml;charset=utf-8", datatype: "json", headers: { soapaction: '' }, type: 'post', processdata: false, cache: false, success: function (data) { alert("asdsad"); }, error: function (response) { var value = json.stringify(response); alert("error in saving.please try later."+value); } });
but service method not getting called.
on network tab gives me error:
and on console:
edit1:
when change contenttyp :appplication/json;charset=utf-8
http://api.jquery.com/jquery.ajax/
crossdomain point in doc
check it, u send cross domain ajax. it's not allowed default.
Comments
Post a Comment