ASP.NET jQuery - how to invoke server method when asynchronous method is complete? -


I have a jQuery plugin - how to open server side method on progress bar success? The code is below:

(Everything is OK)

  $ ("# & lt;% = this.btnGetData.ClientID%>"). Click (function () (intervalID = setInterval (update progress, 100); $ .ajax ({type: "post", url: "progressbar. Espx / executeport", data: "{}", content type: "app / Jason; Charset = UTF-8 ", Datatype:" Jason ", Async: True, Success: Function (msg) {// should be started here}}); Return Return;});  

As we have installed it in the webform, then you have an ASP.NET AJAX You can use to callback the web method kept in your ASPX file.

First, create your server side method in C # (or NAT language of choice) and comment it with more features, such as:

  [System. Web.Services.WebMethod ()] [System.Web.Script.Services.ScriptMethod ()] Public Static Zero MyServerMethod (string myArgument) {// Something}  

Then your aspx file You need to add a ScriptManager with enabled PageMethods:

  & asp: ScriptManager id = "ScriptManager1" runat = "server" EnablePageMethods = "true" />  

Then call it with your jQuery breakthrough event:

  success: function (msg) {PageMethods.MyServerMethod (msg); }  

I am based on this (which is not specific to jQuery). However, read about more information about using jQuery with WebMethods.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -