jquery - Calling webservice with JqueryMobile won't work -


can tell me problem in code:

$('#callajax').live('click', function (event) {     // $("#resultlog").html("working....");      $.ajax({         type: "post",         contenttype: "application/json; charset=utf-8",         url: "hello.asmx/helloworld",         data: "{}",         datatype: "json",         success: function (msg) {             alert(msg);             //$("#resultlog").html(msg);         }     }); // end of ajax       $("#resultlog").ajaxerror(function (event, request, settings, exception) {          $("#resultlog").html("error calling: " + settings.url + "<br />htpp code: " + request.status);      });   });  // end of click 

some code in in html file

<input id="callajax" type="button" value="call ajax" />       <div id="resultlog"></div> 

here web-service:

using system; using system.collections.generic; using system.linq; using system.web; using system.web.services; using system.web.script.serialization;      /// <summary>     /// summary description webservice     /// </summary>     [webservice(namespace = "http://tempuri.org/")]     [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)]     // allow web service called script, using asp.net ajax, uncomment following line.       [system.web.script.services.scriptservice]     public class webservice : system.web.services.webservice {      public webservice () {          //uncomment following line if using designed components          //initializecomponent();      }      [webmethod]     public static string helloworld() {         return "hello world";     }  } 

the return value is: error calling: hello.asmx/helloworld htpp code: 500.

asmx file in same folder custom javascript file in call web-service. tried lot, had no luck in finding solution. appreciate on this!

try setting $.mobile.allowcrossdomainpages = true; , check if $.support.cors set true or not. if not set true explicitly:

<script type="text/javascript"> alert("changed" + " " + $.mobile.allowcrossdomainpages); $(window.document).bind("mobileinit", function() {     alert("mobileinit" + " " + $.support.cors);     $.mobile.allowcrossdomainpages = true; }); </script> 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -