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:

enter image description here

and on console:

enter image description here

edit1:

when change contenttyp :appplication/json;charset=utf-8

enter image description here

http://api.jquery.com/jquery.ajax/

crossdomain point in doc

check it, u send cross domain ajax. it's not allowed default.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -