c# - ASP.NET a problem with jQuery's ajax function -


I have the button and it's jQuery script (to start the progress bar):

 < Code> & lt; Script src = "..//// files / jscript / junkie-1.3.2.js", "text / javascript" & gt; & Lt; / Script & gt; & Lt; Script src = "..// files / jscript / jquery-ui-1.7.2.custom.min.js" type = "text / javascript" & gt; & Lt; / Script & gt; Var IntervalID; Click on $ ("# by & lt;% = this.Button1.ClientID%>") (function {intervalID = setInterval (UpdateProgress, 500); $ .ajax ({type: "Post", URL: "CustomerImport .aspx / ExecuteImport", data: "{}", contentType: "application / json; charset = utf-8", datatype: "json", async: true, success: function () {$ ( "# Progress bar") progress bar ("value", 100); clear interval (interval id); $ ("# result"). Text ('OK');}}); return;}); Function UpdateProgress () {$ .ajax ({Type: "Post", URL: "CustomerImport.aspx / GetProgress", Data: "{}", contentType: "application / json; charset = utf-8", datatype: " Json ", async: true, success: function (msg) {$ (" # result "). Text = msg.d; var value = $ (" # progressbar "). Progressbar (" option "," value "); If the value (value & lt; 100) {$ ("# progressbar"). Progress bar ("value", msg.d); $ ("# result"). Text (msg.d);} and {clear interval ( Interval ID); Window.location = window.location;}}}); }  

Method:

  [System.Web.Services.WebMethod] Public Zero ExecuteImport () {_Presenter.ExecuteImport (); }  

The problem is that the method is not being implemented. Why?

When I change the $ .jax like warning ('OK'); shows the warning, so it works

Do you feature your service class Decorated? In addition, try changing the data parameter to: data: {} What is it to say about this? Is a request being sent? If so, what is the server responding?

In addition to this you have a mistake in your URL (web services have an ASMX extension). You wrote:

  CustomerImport.aspx / ExecuteImport  

This should be compared to:

  CustomerImport.asmx / ExecuteImport  

this is a complete working example that you can customize according to your needs:

web services:

  [ WebService (namespace = "http: //tempuri.org/")] [WebServiceBinding (ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem (false)] [ScriptService] public class CustomerImport: WebService {[WebMethod] public void ExecuteImport () { }}  

Calling web page:

  & lt;% @ page language = "c #"%> & Lt ;; Doctype html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> & Lt; Title & gt; Test & lt; / Title & gt; & Lt; Script type = "text / javascript" src = "scripts / jquery-1.4.1.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Function () {$. Ajax ({type: 'POST', url: '/CustomerImport.asmx/ExecuteImport', data: {}, success: function () {alert ( 'OK');}}); }); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form runat = "server" & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

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? -