how to deal with async calls in Ajax 4.0(using jquery?)

Posted by dexter on Stack Overflow See other posts from Stack Overflow or by dexter
Published on 2010-01-27T07:29:36Z Indexed on 2010/05/16 5:10 UTC
Read the original article Hit count: 142

Filed under:
|
|
|

in my code i have done something like this.

 $.get('/Home/Module/Submit',
                { moduleName: ModName,
                    moduleParameters: moduleParameters
                },

   function(result) {


       $("#" + target).html(result);

   });

when i put alert in the function(result) {..} it shows html perfectly(both in alert and at the 'target'-on the .aspx page) BUT when i remove the alert.. on the page the 'html' don't appear or appear randomly (this method is called multiple times)

i think that the 'result' comes to function asynchronously thats why it is not bind with the respective 'div' however in the last iteration it gets bind every time.

can we make process stop until data gets bind? or is there any functionality (like alert) which can make data bind.. without disturbing UI (unlike alert)?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX