web services - Jquery ajax not getting called in asp.net2.0? -


I am using ASP.Net 2.0. I'm trying to learn webservice and call that webservice using the jazzery Ajax method.

The problem is that jquery is not working properly AJAX and I can not know where I Has gone wrong.

This is my jquery code

  & lt; Script type = "text / javascript" src = "http://code.jquery.com/jquery-1.9.1.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ("# button1"). Click (function () {$ .ajax ({type: "POST", url: "/ WebService.asmx / GetDateTime", data: "{}", Content Type: "Application / Jason; Charset = UTF-8", Datatype: "Jason", succss: Function (msg) {Alert ("Success");}, Failure: Function (Feedback) {Warning (" Error ");}});});}); & Lt; / Script & gt;   

This is my web service

  [WebMethod] Public string GetDateTime () {DateTime.Now.ToString (); }   

that HTML portion is

   & Lt; Span id = "output" & gt; & Lt; / Span & gt; & Lt; / Div & gt; & Lt; / Form & gt;    

If your button dynamically "live" Uses Bind Event

  $ ("# button1") Live ("click", function () {...});   

Note: Make sure that your ID is similar to the one generated in the page, check the ASP.NET change ID in browser for 'ct00_button1' to inspect the element < / Div>

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -