Advertisement
TheSlovakGuy

Untitled

Nov 7th, 2014
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. PHP:
  2.  
  3. <!DOCTYPE HTML>
  4. <html>
  5. <head>
  6. <?php
  7. echo "<title>", "Just a test", "</title>";
  8. ?>
  9. <meta charset="utf-8" />
  10. <script src="jquery/jquery.js"></script>
  11. <script src="jquery/jquery-ui/jquery-ui.min.js"></script>
  12. <script src="data/scripts/test_master.js"></script>
  13. <link rel="stylesheet" type="text/css" href="jquery/jquery-ui/jquery-ui.min.css" />
  14. <style>
  15. body{
  16. font-family: sans-serif;
  17. width: 1020px;
  18. margin: 25px auto;
  19. }
  20. #logStat{
  21. margin: auto;
  22. text-align: center;
  23. padding: 10px;
  24. width: 60%;
  25. border-radius: 5px;
  26. background-color: #B3B3B3;
  27. }
  28. </style>
  29. </head>
  30. <body onload="loaded()">
  31. <form action="data/scripts/submit_form.php" method="post">
  32. <input required type="text" placeholder="Name" name="nameIn" /><br />
  33. <input required type="text" placeholder="ID" name="idIn" /><br />
  34. <input required type="text" maxlength="10" placeholder="Phone number" name="phoneIn" /><br />
  35. <input type="submit" value="Run PHP" id="submitBtn"/>
  36. </form>
  37. <button type="button" onclick="verifyServer()">Pre-check data</button>
  38. <div id="logStat">
  39. <div id="progBar"></div>
  40. <p id="writeThis"></p>
  41. </div>
  42. </body>
  43. </html>
  44.  
  45.  
  46. JS:
  47.  
  48. function loaded(){
  49. $(document).ready(function(){
  50. $("#submitBtn").hide();
  51. $("#logStat").hide();
  52. });
  53. }
  54.  
  55. function verifyServer(){
  56. $("#logStat").fadeIn(200);
  57. $("#progBar").progressbar();
  58.  
  59. $("#progBar").progressbar("value", 0);
  60. document.getElementById("writeThis").innerHTML = "Verifying name...";
  61. if(document.getElementById("nameIn").value == null){
  62. document.getElementById("writeThis").innerHTML = "ERROR: Name is NULL.";
  63. setTimeout(function(){ $("#logStat").fadeOut(200); }, 2000);
  64. return;
  65. }
  66.  
  67. $("#progBar").progressbar("value", 25);
  68. document.getElementById("writeThis").innerHTML = "Verifying ID...";
  69. if(document.getElementById("idIn") == null || isNaN(checkData)){
  70. document.getElementById("writeThis").innerHTML = "ERROR: ID is NULL.";
  71. setTimeout(function(){ $("#logStat").fadeOut(200); }, 2000);
  72. return;
  73. }
  74.  
  75. $("#progBar").progressbar("value", 50);
  76. document.getElementById("writeThis").innerHTML = "Verifying phone number...";
  77. if(document.getElementById("phoneIn") == null || isNaN(checkData)){
  78. document.getElementById("writeThis").innerHTML = "ERROR: Phone number is NULL.";
  79. setTimeout(function(){ $("#logStat").fadeOut(200); }, 2000);
  80. return;
  81. }
  82.  
  83. $("#progBar").progressbar("value", 75);
  84. document.getElementById("writeThis").innerHTML = "Locking data...";
  85. document.getElementById("nameIn").setAttribute("disabled", true);
  86. document.getElementById("idIn").setAttribute("disabled", true);
  87. document.getElementById("phoneIn").setAttribute("disabled", true);
  88.  
  89. $("#progBar").progressbar("value", 100);
  90. document.getElementById("writeThis").innerHTML = "Done!";
  91. setTimeout(function(){ $("#logStat").fadeOut(200); }, 500);
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement