Posted By

spraitas on 04/01/09


Tagged


Versions (?)

Who likes this?

8 people have marked this snippet as a favorite

indamix
nreliu
umang_nine
danielfilho
gregorio
vali29
koyotebr
thomas-h


Ajax request


 / Published in: jQuery
 

  1. $("form").submit(function() {
  2. $("#loading_error").hide();
  3.  
  4. $("#loading").ajaxStart(function(){
  5. $(this).show();
  6. $("#item_submit").attr("disabled","disabled");
  7. });
  8.  
  9. $.ajax({
  10. type: "POST",
  11. dataType: "json",
  12. url: "./post",
  13. data: $("form").serialize(),
  14. success: function(data){
  15. },
  16. error: function (XMLHttpRequest, textStatus, errorThrown) {
  17. $("#loading_error").show();
  18. return false;
  19. }
  20. });
  21.  
  22. $("#loading").ajaxStop(function(){
  23. $(this).hide();
  24. $("#item_submit").removeAttr("disabled");
  25. });
  26.  
  27. return false;
  28. });

Report this snippet  

You need to login to post a comment.