Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="stylesheet" href="style.css" type="text/css"></link>
  5. <script src="http://code.jquery.com/jquery-latest.js"></script>
  6. <script>
  7. $(function() {
  8. // load up the results initially with AJAX call
  9. // see http://api.jquery.com/load/
  10. $('#ajax_results').load('PencarumMengikutTahun.php');
  11.  
  12. //make AJAX GET calls as user types..
  13. $('#fname').keydown( function(){
  14. //send the value to the php script in the querystring
  15. var nme = $(this).val().trim();
  16. $('#ajax_results').load('PencarumMengikutTahun.php?fname='+nme);
  17. });
  18.  
  19. $('#AjaxPencarumMengikutTahun').submit( function(){
  20. //send the form values via POST with javascript object
  21. var data =
  22. {
  23. tarikhdaftar: $('#tarikhdaftar').val(),
  24. icPencarum: $('#icPencarum').val()
  25. };
  26. $('#ajax_results').load('PencarumMengikutTahun.php', data);
  27.  
  28. //prevent the normal submit action since we're using AJAX
  29. return false;
  30. });
  31.  
  32. });
  33. </script>
  34. </head>
  35.  
  36. <body>
  37. <form action="PencarumMengikutTahun.php" method="get">
  38. <label for="fname">Tahun</label> <input type="text" name="fname" id="fname" />
  39. </form>
  40.  
  41. <div id="error"></div>
  42. <div id="ajax_results"></div>
  43.  
  44. </body>
  45. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement