dongqishun6409 2013-09-12 08:13
浏览 56

将包含数据库的php数组传递给jquery进行操作

i have a combo box in html and i wish to show data comming from database in it by manipulating it to if database result have abc/cde/etc and user put a these all will display i did this through jquery but couldnt find a dynamic way to paas values..

enter code here

 <?php
 // Connects to your Database
 $connection=mysql_connect("localhost","root","");
 $db="kukreja";
 mysql_select_db($db,$connection) or die("could not open $db");
 $sql="SELECT*FROM add_item";
 $result=mysql_query($sql,$connection) or die("could not execute sql:$sql");

 $num_result=mysql_fetch_Array($result);


 ?>



 <script type="text/javascript">
 jQuery(function($) {

 var availableTags = [
    "ActionScript",
    "AppleScript",
    "Asp",
    "BASIC",
    "C",
    "C++",
    "Clojure",
    "COBOL",
    "ColdFusion",
    "Erlang",
    "Fortran",
    "Groovy",
    "Haskell",
    "Java",
    "JavaScript",
    "Lisp",
    "Perl",
    "PHP",
    "Python",
    "Ruby",
    "Scala",
    "Scheme"
    ];
     $( "#tags" ).autocomplete({
    source: availableTags
      });

    });
     </script>
  • 写回答

2条回答

  • dprnr5559 2013-09-12 08:26
    关注

    Use jQuery ajax . Let's check the bellow example

    Example

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog