Guest User

Untitled

a guest
Jul 22nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <?php
  2.  
  3. echo "hello";
  4.  
  5. ?>
  6.  
  7. <script type="text/javascript" src="jquery.js"></script>
  8.  
  9. <script type="text/javascript">
  10. $(document).ready(function(){
  11.  
  12. $("div.click_me").live('click',function(){
  13.  
  14.  
  15. $.ajax({
  16.  
  17. type:"POST",
  18. data:null,
  19. url:"xyz.php",
  20. success:function(response){
  21.  
  22. alert(response);
  23.  
  24. }
  25.  
  26. })
  27.  
  28.  
  29. });
  30.  
  31.  
  32.  
  33. });
  34.  
  35.  
  36.  
  37.  
  38. </script>
  39.  
  40.  
  41. <div class="click_me"> CLICK </div>
  42.  
  43. <script type="text/javascript">
  44. $(document).ready(function(){
  45.  
  46. $("div.click_me").live('click',function(){
  47.  
  48. res=xxx();
  49.  
  50. alert(res)
  51.  
  52. });
  53.  
  54.  
  55.  
  56. });
  57.  
  58. function xxx(){
  59.  
  60.  
  61. $.ajax({
  62.  
  63. type:"POST",
  64. data:null,
  65. url:"xyz.php",
  66. success:function(response){
  67.  
  68. res=response;
  69.  
  70. }
  71.  
  72. })
  73.  
  74. return res;
  75.  
  76. }
  77.  
  78.  
  79. </script>
  80.  
  81. res = xxx();
  82. alert(res);
  83.  
  84. $('div.click_me').live('click',function()
  85. {
  86. function alertCallback(x)
  87. {
  88. alert(x);
  89. }
  90.  
  91. xxx(alertCallback);
  92. });
  93.  
  94. function xxx(callback)
  95. {
  96. $.post('xyz.php', null, function (result)
  97. {
  98. callback(result);
  99. });
  100. }
  101.  
  102. return res;
  103.  
  104. $.ajax({
  105.  
  106. type:"POST",
  107. data:null,
  108. url:"xyz.php",
  109. success:function(response){
  110.  
  111. callback(response);
  112.  
  113. }
  114.  
  115. })
  116.  
  117. return res;
  118.  
  119. $("div.click_me").live('click',function(){
  120.  
  121. res=xxx();
  122.  
  123. alert(res)
  124.  
  125. });
  126.  
  127. $.ajax({
  128.  
  129. type:"POST",
  130. data:null,
  131. url:"xyz.php",
  132. success:function(response){
  133.  
  134. res=response;
  135. alert("abc");
  136.  
  137. }
  138.  
  139. })
  140. alert("xyz");
  141. return res;
Add Comment
Please, Sign In to add comment