Posted By

staley412 on 11/24/09


Tagged

ajax javascript js


Versions (?)

Ajax Example


 / Published in: JavaScript
 

Sends the request to the VB to get the information

  1. function loadStuff(sort, order) {
  2. if (typeof sort == 'undefined')
  3. sort = "";
  4.  
  5. if (typeof order == 'undefined')
  6. order = "";
  7.  
  8. new Ajax.Request(
  9. './manuModel_Req.aspx',
  10. {
  11. method:'post',
  12. onCreate: function(){
  13. },
  14. onComplete: function(){
  15. },
  16. onSuccess: function(transport){
  17. //Handle Successful Response
  18.  
  19. var obj = transport.responseText.evalJSON();
  20. handleLoadStuff(obj);
  21.  
  22. },
  23. parameters: {
  24. requestType:"loadStuff",
  25. PageIndex:curPage['stuff'],
  26. column:sort,
  27. direction:order,
  28. filter: "retain filter"
  29.  
  30. },
  31. onException: function(transport,ex){
  32. //Turn Error Indicator On
  33. //Javascript Exception
  34. _sendErr("Unable to Load Stuff on Page. (loadStuff)", transport.status, "javascript.js");
  35. $('StuffResults').innerHTML = "<span style=\"color: red\">Error: " + transport.status + "</span>";
  36. },
  37. on406: function(transport){
  38. //Turn Error Indicator On
  39. //Server Error
  40. _sendErr("Page Name - Error 406. (loadStuff)", transport.status, "javascript.js");
  41. $('StuffResults').innerHTML = "<span style=\"color: red\">Error: " + transport.status + "</span>";
  42. }
  43. }
  44. );
  45.  
  46. }

Report this snippet  

You need to login to post a comment.