freddy0512

view

Mar 26th, 2015
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Welcome to CodeIgniter</title>
  6. <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  7. <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  8. <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  9. <link rel="stylesheet" href="/resources/demos/style.css">
  10.  
  11. <script type="text/javascript">
  12. $(function(){
  13. $("#birds").autocomplete({
  14. source: "<?php echo base_url(); ?>index.php/birds/get_birds"
  15.  
  16. });
  17.  
  18. $("#birds").result(function(event, data, formatted) {
  19. var kode = formatted;
  20. $.ajax({
  21. type : "POST",
  22. data : "kode="+kode,
  23. url : "<?php echo base_url(); ?>index.php/birds/get_name",
  24. dataType: "json",
  25. success: function(data){
  26. $("#bird").val(data.bird);
  27. $("#aka").val(data.aka);
  28. }
  29. });
  30. });
  31. });
  32. </script>
  33.  
  34. </head>
  35. <body>
  36.  
  37.  
  38.  
  39. <div class="ui-widget">
  40. <label for="tags">Tags: </label>
  41. <input type="text" id="birds" />
  42. <input type="text" id="bird" />
  43. <input type="text" id="aka" />
  44. </div>
  45.  
  46. </body>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment