php - How would you use jQuery autocomplete with a MySQL database -


i want use terms stored in table called terms id , term columns

how use autocomplete database instead of array?

<!doctype html> <html> <head>   <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>   <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>    <script>   $(document).ready(function() {     $("input#autocomplete").autocomplete({         source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]     });   });   </script> </head> <body style="font-size:62.5%;">  <input id="autocomplete" />  </body> </html> 

you can array ajax call or initialize @ page load like

<script> var myarr = [<?php foreach($dbrows $row){ echo "\"$row['keyword']\","} ?>]; </script> 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -