GepComty

Ajax Coba

Dec 25th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. //Javascript
  2. $(document).ready(function(){
  3.  
  4. $("#akux").click(function(){
  5. $.ajax({
  6. type:"POST",
  7. url:"data/proses.php",
  8. data: "aksi=tampil",
  9. success: function(data){
  10. $(".hasil").html(data);
  11. }
  12. });
  13. });
  14.  
  15. $("#akux2").click(function(){
  16. $.ajax({
  17. type:"POST",
  18. url:"data/proses.php",
  19. data: "aksi=tampil2",
  20. success: function(data){
  21. $(".hasil2").html(data);
  22. }
  23. });
  24. });
  25.  
  26. });
  27.  
  28. //index.php
  29. <html>
  30. <head>
  31. <meta charset="utf-8">
  32. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  33. <meta name="description" content="">
  34. <meta name="author" content="">
  35. <title>Kecamatan Gununganyar</title>
  36. <script src="js/jquery.js"></script>
  37. <script src="js/jquery.min.js"></script>
  38. <script src="js/coba.js"></script>
  39. </head>
  40. <body>
  41. <input name="aku" type="button" value="AKU 1" id="akux">
  42. <div class="hasil"></div>
  43. <div class="hasil2"></div>
  44. </body>
  45. </html>
  46.  
  47. //Folder Data (proses.php)
  48. <html>
  49. <head>
  50. <meta charset="utf-8">
  51. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  52. <meta name="description" content="">
  53. <meta name="author" content="">
  54. <title>Kecamatan Gununganyar</title>
  55. <script src="js/jquery.js"></script>
  56. <script src="js/jquery.min.js"></script>
  57. <script src="js/coba.js"></script>
  58. </head>
  59. <body>
  60. <input name="aku" type="button" value="AKU 1" id="akux">
  61. <div class="hasil"></div>
  62. <div class="hasil2"></div>
  63. </body>
  64. </html>
Advertisement
Add Comment
Please, Sign In to add comment