使用JQuery加载和更改此PHP脚本 [英] load and change this php script using JQuery

查看:59
本文介绍了使用JQuery加载和更改此PHP脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
  <script>
  $(document).ready(function () {
  var $article = null;
  var $business = null;

  $('#category').change(function () {
   var categoryName = $('#category').val();

   if ($article == null) {
    $article = $('<h4>Select a business you wish to view.</h4><select id="article" name="article">
    <option value="0">Select A Business To View Listing</option>
    </select>').appendTo('.query');
   }
   });
  });
</script>





使用此JQuery脚本可以调整它以在从中选择对象时运行此查询第一个选择框&更改查询以包括选择Where Category =$('#category')。val();





Using this JQuery script can you adjust it to run this query upon selecting an object from the first select box & change the query to include the selection Where Category = "$('#category').val();"

<?php
        $con = mysqli_connect(,,,,);
        // Check connection
        if (mysqli_connect_errno())
           {
           echo "<option>Failed to connect to MySQLi</option>" ;
           }
        $result = mysqli_query($con,"SELECT Bname FROM Business WHERE Category='$('#category').val();
' ");
         while($row = mysqli_fetch_array($result)) {
          echo "<option value='".$row['Bname']."'>".$row['Bname']."</option>";
          }
          // Free result set
         mysqli_free_result($result);
         mysqli_close($con);
?>

推荐答案

(document).ready(function(){
var
(document).ready(function () { var


article = null;
var
article = null; var


business = null;
business = null;


这篇关于使用JQuery加载和更改此PHP脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆