Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <!--
  3. To change this license header, choose License Headers in Project Properties.
  4. To change this template file, choose Tools | Templates
  5. and open the template in the editor.
  6. -->
  7. <html>
  8. <head>
  9. <meta charset="UTF-8">
  10. <title>
  11. Javascript Review
  12. </title>
  13.  
  14. <script
  15. src="http://code.jquery.com/jquery-3.2.1.min.js"
  16. integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
  17. crossorigin="anonymous">
  18. </script>
  19. </head>
  20. <body>
  21. <input type="text" id="textInput"/>
  22.  
  23. <!-- <button type="button" id="btnElement">
  24. Show me
  25. </button>-->
  26.  
  27. <div id="content">
  28.  
  29. </div>
  30.  
  31. </body>
  32.  
  33. <script type="text/javascript">
  34. document.getElementById("textInput").onkeyup = function () {
  35. $.ajax({
  36. "method": "POST",
  37. "url": "ajaxReceiver.php",
  38. "dataType": "JSON",
  39. "data":
  40. {
  41. "textValue": $("#textInput").val()
  42. },
  43. success: function (res) {
  44. $("#content").html(res.revString);
  45. }
  46. })
  47. }
  48.  
  49.  
  50. // var textInput = document.getElementById("textInput");
  51. // textInput.onkeyup = function () {
  52. // alert("Simpleng alert");
  53. // }
  54. //
  55. // var divContent = document.getElementById("content");
  56. // textInput.onkeyup = function () {
  57. // divContent.innerHTML = textInput.value;
  58. // }
  59. //
  60. // var jTextInput = $("#content");
  61. // jTextInput.keyup(function () {
  62. // $("#content").html("");
  63. // $("#textInput").val();
  64. // });
  65. //
  66. // document.getElementById("btnElement").onclick = function () {
  67. // var divContent = document.getElementById("content");
  68. // divContent.innerHTML = "<h1>Welcome to WebApp2</h1>";
  69. // }
  70. </script>
  71. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement