views:

121

answers:

2

I'm new to JQuery, but as a follow on from my previous question regarding duplicated entries to the database, on a forum type application, the question is: Is JQuery a good solution to show to the user, transaction progress, state of submit etc And what is the best solution, if using JQuery Else what other solution is right.

With a view to learning JQuery, and integrating into my application, to replace asp.net ajax extenders, and partial page postbacks, can anyone point me in the direction of helpful resource.

Thanks

+1  A: 

You can use jQuery.ajax to send the request back to the server for processing. Set up beforeSend and complete callbacks to show/hide an "in progess" image, say an animated GIF spinner. You can also use the error callback to show an error message or dialog when the request fails.

 $.ajax({
   type: "POST",
   url: "forum-update.aspx",
   data: $('form').serialize(),
   beforeSend: function() { $('#spinner').show() },
   complete: function() { $('#spinner').hide() },
   error: function(request,status,error) {
       alert(error); // or maybe status?
   },
   success: function(msg){
     alert( "Data Saved: " + msg );
   }
 });
tvanfosson
thanks for the code posted, I'll look into this, seems like it will replace the update spinner I use for update panels updates
Stuart
+1  A: 

jQuery sounds to me as the perfect tool for that, you could use these effects:

http://docs.jquery.com/Effects

combined with an ajax call

http://docs.jquery.com/Ajax

used as asyncronous = false, so you revert the effect to the original state, once the ajax call has finished.

Of course then, there are plugins, but with these you can make your own behaviour easily.

antonioh