Question

I have an extender control and want a call to webmethod from within it. but neither Sys.net.webserviceproxy.invoke nor $.ajax working. $.ajax issues server timed out error. invoke works but does not call the web method. the code is below

   [WebMethod]
public static string calculateTime(string dateTime) {

    return result;
}

the method in extender control that calls the webmethod.

  timer: function(){


           Sys.Net.WebServiceProxy.invoke("CaculateTime.asmx", "calculateTime",false,{"dateTime":""+this._timestamp+""}, function (result, e){ this.get_element().innerText=result  ;}, function(result, e){},"User Context", 100);

},
Was it helpful?

Solution 2

I was using Path address as "CalculateTime.asmx". However, this is the case with asp.net. I am calling it from javascript so It should be "http://localhost:18194/applicationname/Calculate.asmx/calculateTime". It wasted a lot of my time.

OTHER TIPS

Remove static modifier from the calculateTime. I believe that you was confused with page methods those indeed must be static to allow async calls.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top