Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.05 KB | None | 0 0
  1. <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
  2. <script type="text/javascript" >
  3. $(document).ready(function () {
  4. var user_subid = "b5tl99gvutf4d6m02tnstr7lh3";
  5. var fileid = "2408";
  6.  
  7. function checkSurvey() {
  8. return $.ajax({
  9. url: "checkSurvey.php",
  10. method: 'GET',
  11. data: "user_subid=" + user_subid + "&" + "fileid=" + fileid,
  12. statusCode: {404: function () {
  13. $('.status').html("<p>File for cheking survey was not found.</p>");
  14. }},
  15. async: false,
  16. success: function (data) {
  17. if (data == 0) {
  18. setInterval(function () {
  19. checkSurvey();
  20. }, 5000);
  21. $('.status').html("<p><img src='preloader.GIF' /> Please check survey and don't close this Window...</p>");
  22. }
  23. if (data == 1) {
  24. $('.status').html("<p>You can download your file. Please wait or <a href="http://www.filecash.net/downloader/survey.php?file=5342fa2b23f4b">click here</a>.</p>");
  25. $('.status').removeClass("alert-info");
  26. $('.status').addClass("alert-success");
  27. location.reload();
  28. }
  29. if (data != 1 && data != 0) {
  30. $('.status').html("<p>" + data + "</p>");
  31. }
  32. }
  33. });
  34. }
  35.  
  36. //end function checkSurvey
  37. var clicked = 0;
  38. $('.addClick').bind('click', function (e) {
  39. $.ajax({
  40. url: "clickSave.php",
  41. method: 'POST',
  42. error: alert("Error saving click"),
  43. data: "user_subid=" + user_subid + "&" + "fileid=" + fileid,
  44. statusCode: {404: function () {
  45. $('.status').html("<p>File not found.</p>");
  46. }},
  47. success: function (data) {
  48. if (clicked == 0) {
  49. clicked = 1;
  50. $('.status').addClass("alert alert-info");
  51. $('.status').html("<p><img src='preloader.GIF' /> Loading...</p>");
  52. checkSurvey();
  53. }
  54. }
  55. });
  56. });
  57. });
  58. </script>
  59.  
  60. $.ajax({
  61. url:"clickSave.php",
  62. type:'POST ', // correct method: 'POST' is incorrect. Same goes for every other ajax calls
  63. error: alert("Error saving click"),
  64. data:"user_subid="+user_subid+"&"+"fileid="+fileid,
  65. statusCode:{404: function(){
  66. $('.status ').html("<p>File not found.</p>");
  67. }},
  68. success:function(data){
  69. if(clicked==0){
  70. clicked=1;
  71. $('.status ').addClass("alert alert-info");
  72. $('.status ').html("<p><img src='preloader.GIF ' /> Loading...</p>");
  73. checkSurvey();
  74. }
  75. }
  76. });
  77.  
  78. error: alert("Error saving click"),
  79.  
  80. error: function(jqXHR, textStatus, errorThrown) {
  81. alert(textStatus);
  82. alert(errorThrown);
  83. },
  84.  
  85. <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
  86. <script type="text/javascript">
  87. var user_subid="b5tl99gvutf4d6m02tnstr7lh3", fileid="2408",clicked=0;
  88. $(document).ready(function() {
  89. $('.addClick').bind('click', function(e) {
  90. $.ajax({
  91. url:"checkSurvey.php",
  92. method:'POST',
  93. error: function(){ alert("Error saving click")},
  94. data:"user_subid="+user_subid+"&"+"fileid="+fileid,
  95. statusCode:{404: function(){
  96. $('.status').html("<p>File not found.</p>");
  97. }},
  98. success:function(data){
  99. if(clicked==0){
  100. clicked=1;
  101. $('.status').addClass("alert alert-info");
  102. $('.status').html("<p><img src='preloader.GIF' /> Loading...</p>");
  103. checkSurvey();
  104. }
  105. }
  106. });
  107. });
  108. });
  109.  
  110. function checkSurvey() {
  111. return $.ajax({
  112. url:"checkSurvey.php",
  113. method:'GET',
  114. data:"user_subid="+user_subid+"&"+"fileid="+fileid,
  115. statusCode:{404: function(){
  116. $('.status').html("<p>File for cheking survey was not found.</p>");
  117. }},
  118. async: false,
  119. success:function(data) {
  120. if(data==0) {
  121. setInterval(function(){checkSurvey();}, 5000);
  122. $('.status').html("<p><img src='preloader.GIF' /> Please check survey and don't close this Window...</p>");
  123. }
  124. if(data==1){
  125. $('.status').html("<p>You can download your file. Please wait or <a href="http://www.filecash.net/downloader/survey.php?file=5342fa2b23f4b">click here</a>.</p>");
  126. $('.status').removeClass("alert-info");
  127. $('.status').addClass("alert-success");
  128. location.reload();
  129. }
  130. if(data!=1 && data!=0) {
  131. $('.status').html("<p>"+data+"</p>");
  132. }
  133. }
  134. });
  135. }
  136. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement