views:

46

answers:

2

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 status of Ajax callback before it displays the information. So, the information is not there yet until you click on the link.

alt text

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.

+2  A: 

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.

Robert Greiner
A: 

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

Muhammad Adeel Zahid