views:

112

answers:

1

Hello StackOverflow! I was hoping for a little help. I am currently using some of the jQueryUI widgets in an ASP.Net Web App. I have successfully got everything working. Basically, I have a GridView on a page which contains some hidden fields in each row containing data. I also have a dialog div containing an update panel and a few Labels.

When a user clicks on an Image Button on the GridView, the jQuery is fired to show the jQueryUI dialog and code behind is used to fill the labels from the selected GridView row. Unfortunately, the AJAX communication takes quite a bit longer to update versus showing the dialog div.

The same question actually applies to the loading of an ASP page into a jQuery popup window also as I will need to eventually do this.

So my questions are:

  • How can I make jQuery wait to execute until after the partial postback has returned with the AJAX information for the popup?
  • Is the above method the right way to go?
  • Is there a better way?
  • Is there a way to speed up AJAX communications to make it more instantaneous?

Thanks in advance for your input.

+1  A: 

without knowing exactly what you're doing (code wise), the best I can understand is that you want to trigger some behavior after the ajax call has completed, which is actually supported like so:

$.ajax({
  url: 'myurl.aspx',
  success: function(data) {
    //everything you want to happen after the ajax completes.
    //this can either be code, or a call to another function that loads your div
  }
});
Oren Mazor
That seems to work great. Thank you!
ThaKidd