Guest User

Untitled

a guest
Jun 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. $(document).ready(function() {
  2. $.ajax({
  3. type: "POST",
  4. contentType: "application/json; charset=utf-8",
  5. dataType: "json",
  6. url: "test12.aspx/GetHtmlTest",
  7. //data: "{ 'Dividend': '" + $("#Dividend").val() + "' }",
  8. data: "{}",
  9. // Error!
  10. error: function(xhr, status, error) {
  11. // Boil the ASP.NET AJAX error down to JSON.
  12. //var err = eval("(" + xhr.responseText + ")");
  13.  
  14. // Display the specific error raised by the server
  15. //alert(err.Message);
  16. alert("AJAX Error!");
  17. },
  18. success: function(msg) {
  19. $("#queuediv1").removeClass('isequeue_updating');
  20. $("#queuediv1").html(msg);
  21. //an unorderd list with the tag "browserxx" was just inserted into the div
  22. $("#browserxx").treeview();
  23. }
  24. });
  25. });
  26.  
  27. $(document).ready(function() {
  28. for (i= 1;i<=4;i++)
  29. {
  30. var divname ="#queuediv"+i;
  31.  
  32. $.ajax({
  33. type: "POST",
  34. contentType: "application/json; charset=utf-8",
  35. dataType: "json",
  36. url: "test12.aspx/GetHtmlTest",
  37. // data would be populated differently so that each div gets its own result- for now it doesn't matter
  38. //data: "{ 'Dividend': '" + $("#Dividend").val() + "' }",
  39. data: "{}",
  40. // Error!
  41. error: function(xhr, status, error) {
  42. // Boil the ASP.NET AJAX error down to JSON.
  43. //var err = eval("(" + xhr.responseText + ")");
  44.  
  45. // Display the specific error raised by the server
  46. //alert(err.Message);
  47. alert("AJAX Error!");
  48. },
  49. success: function(msg) {
  50. $(divname).removeClass('isequeue_updating');
  51. $(divname).html(msg);
  52. $("#somethingfromthemsg").treeview();
  53. }
  54. });
  55. }
  56. });
  57.  
  58. $(document).ready(function() {
  59. for (i= 1;i<=4;i++)
  60. {
  61. (function (){
  62. var divname ="#queuediv"+i;
  63.  
  64. $.ajax({
  65. type: "POST",
  66. contentType: "application/json; charset=utf-8",
  67. dataType: "json",
  68. url: "test12.aspx/GetHtmlTest",
  69. data: "{}",
  70. error: function(xhr, status, error) {
  71. alert("AJAX Error!");
  72. },
  73. success: function(msg) {
  74. $(divname).removeClass('isequeue_updating');
  75. $(divname).html(msg);
  76. $("#somethingfromthemsg").treeview();
  77. }
  78. });
  79. })();
  80. }
  81. });
  82.  
  83. <div id="output1"></div><div id="output2"></div><div id="output3"></div><div id="output4"></div><div id="output5"></div>
  84. <script language="javascript">
  85. for(var a=1; a<=5; a++) {
  86. (function (){
  87. var divName = "output" + a;
  88. var b = a;
  89. setTimeout(function(){document.getElementById(divName).innerHTML = b;}, 2000);
  90. })();
  91. }
  92. </script>
  93.  
  94. function makeSuccessFunc (divname) {
  95. return function (msg) {
  96. $(divname).removeClass('isequeue_updating');
  97. $(divname).html(msg);
  98. $("#somethingfromthemsg").treeview();
  99. };
  100. };
  101.  
  102. $(document).ready(function() {
  103. for (i= 1;i<=4;i++)
  104. {
  105. var divname ="#queuediv"+i;
  106.  
  107. $.ajax({
  108. type: "POST",
  109. contentType: "application/json; charset=utf-8",
  110. dataType: "json",
  111. url: "test12.aspx/GetHtmlTest",
  112. // data would be populated differently so that each div gets its own result- for now it doesn't matter
  113. //data: "{ 'Dividend': '" + $("#Dividend").val() + "' }",
  114. data: "{}",
  115. // Error!
  116. error: function(xhr, status, error) {
  117. // Boil the ASP.NET AJAX error down to JSON.
  118. //var err = eval("(" + xhr.responseText + ")");
  119.  
  120. // Display the specific error raised by the server
  121. //alert(err.Message);
  122. alert("AJAX Error!");
  123. },
  124. success: makeSuccessFunc (divname)
  125. });
  126. }
  127. });
Add Comment
Please, Sign In to add comment