jquery - Service Handlers


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $('#message').ajaxSend(function(request, settings){
  2. $(this).html('<p class="notice">Starting request at ' + settings.url + '<span>x</span></p>').toggleClass('visible', 1000);
  3. log(request);
  4. log(settings);
  5. });
  6.  
  7. $('#message').ajaxSuccess(function(request, settings){
  8. $(this).html('<p class="success">Successful Request <span>x</span></p>').toggleClass('visible', 1000);
  9. });
  10.  
  11. $('#message').ajaxComplete(function(request, settings){
  12. $(this).html('<p class="notice">Request Complete <span>x</span></p>').toggleClass('visible', 1000);
  13. });
  14.  
  15. $('#message').ajaxError(function(request, settings){
  16. $(this).html('<p class="error">Error requesting page ' + settings.url + '<span>x</span></p>').toggleClass('visible', 1000);
  17. });
  18. a
  19. $('#message').ajaxStart(function(){
  20. //$(this).show(500, callback);
  21. //$('#loading').fadeIn();
  22. });
  23. $('#message').ajaxStop(function(){
  24. //$(this).fadeOut();
  25. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.