开发者

Making AJAX call back in ASP.NET with jQuery

开发者 https://www.devze.com 2023-01-19 15:19 出处:网络
I accept both C# and VB.NET If you visit this http://www.eol.org/pages/983558 and then click on the link like the image below you\'ll see in-line pop-up DIV which displays a busy st开发者_如何学Pyt

I accept both C# and VB.NET

If you visit this http://www.eol.org/pages/983558 and then click on the link like the image below you'll see in-line pop-up DIV which displays a busy st开发者_如何学Pythonatus of Ajax callback before it displays the information. So, the information is not there yet until you click on the link.

Making AJAX call back in ASP.NET with jQuery

I'd like to do the same but ASP.NET and jQuery. If there's any place to help me get started on the right track? Thanks.


Using jQuery to directly call ASP.NET AJAX page methods

$.ajax({
  type: "POST",
  url: "PageName.aspx/MethodName",
  data: "{}",
  contentType: "application/json; charset=utf-8",
  dataType: "json",
  success: function(msg) {
    // Do something interesting here.
  }
});

I think this is probably a good place to start.


yes u can use roberts code to send ajax request to server side code and additionally u can use beforeSend callbck function where u will display ur hidden div with loading.. message and in success function u will actually put the data into that div.

$.ajax({
  type: "POST",
  url: "PageName.aspx/MethodName",
  data: "{}",
  beforeSend: function()
  {
     //display hidden div with loading.. message
  },
  contentType: "application/json; charset=utf-8",
  dataType: "json",
  success: function(msg) {
    // remove loading.. message and put actual data to the div
  }
});

u can use error callback to display error message in the same div if ajax call fails for some reason. u can learn more about $.ajax function here

0

精彩评论

暂无评论...
验证码 换一张
取 消