Problem calling ASP.NET AJAX WebServiceProxy.invoke () Javascript method

I have a problem with the code I wrote. I had to anonymize it, but I can give the problem. This javascript runs inside an iframe and is part of the object being instantiated. The problem is that I get a duplicate error every time "Type" Object "Cannot be converted to type" Function "in invoke () call. However in IE8 developer addon, checking the function type I pass (this.AJAXCallback) it is clear says it is a passed function Is there any special reason for this error?

MyObject.prototype.AJAXCallback=function(Data, e){
    //snip
};

MyObject.prototype.Init=function(){
    var a = window.top.window.Sys.Net.WebServiceProxy.invoke('/Data.asmx', 'GetData', false, { "IDCode":0 }, this.AJAXCallback, null);
    //snip
};

      

+1


a source to share


2 answers


I found the problem and it doesn't seem to be on my part. I disabled debugging in the web.config file and the error was stopped. It also came back after enabling debugging, so I think it's safe to say that the debug code didn't work the same as what I wrote as code without debugging. Specifically, it was one of the scriptmanager JS files.



+1


a source


This could be a problem because the callback is a prototype. Have you tried wrapping the callback with an anonymous function call.



MyObject.prototype.Init=function(){
    var a = window.top.window.Sys.Net.WebServiceProxy.invoke('/Data.asmx', 'GetData', false, { "IDCode":0 }, function(data,e) { 
       this.AJAXCallback(data,e); 
    }, null);
    //snip
};

      

-1


a source







All Articles