Ajax with ASP.Net

RSS
Modified on 2011/12/17 14:01 by Mark Categorized as ajax, aspNet, csharp, dotNet, jQuery

Page Methods with jQuery

public partial class HelloWorld : Page 
{
  [WebMethod]
  public static string getText()
  {
    return "Hello World.";
  }
}

$.ajax({
  type: "POST",
  url: "HelloWorld.aspx/getText",
  data: "{}",
  contentType: "application/json; charset=utf-8",
  dataType: "json",
  success: function(result) {
    // display result.d
  },
  error: function(result) {
    // FAIL!
  }
});


ASMX Webservice with jQuery


MVC and Ajax