久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <i id='ooahG'><tr id='ooahG'><dt id='ooahG'><q id='ooahG'><span id='ooahG'><b id='ooahG'><form id='ooahG'><ins id='ooahG'></ins><ul id='ooahG'></ul><sub id='ooahG'></sub></form><legend id='ooahG'></legend><bdo id='ooahG'><pre id='ooahG'><center id='ooahG'></center></pre></bdo></b><th id='ooahG'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ooahG'><tfoot id='ooahG'></tfoot><dl id='ooahG'><fieldset id='ooahG'></fieldset></dl></div>
        <bdo id='ooahG'></bdo><ul id='ooahG'></ul>

      <tfoot id='ooahG'></tfoot>

      <small id='ooahG'></small><noframes id='ooahG'>

      <legend id='ooahG'><style id='ooahG'><dir id='ooahG'><q id='ooahG'></q></dir></style></legend>

        ajax php 下拉列表

        ajax php drop down list(ajax php 下拉列表)
          <tbody id='i8rHj'></tbody>

          <bdo id='i8rHj'></bdo><ul id='i8rHj'></ul>
        • <small id='i8rHj'></small><noframes id='i8rHj'>

          <i id='i8rHj'><tr id='i8rHj'><dt id='i8rHj'><q id='i8rHj'><span id='i8rHj'><b id='i8rHj'><form id='i8rHj'><ins id='i8rHj'></ins><ul id='i8rHj'></ul><sub id='i8rHj'></sub></form><legend id='i8rHj'></legend><bdo id='i8rHj'><pre id='i8rHj'><center id='i8rHj'></center></pre></bdo></b><th id='i8rHj'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='i8rHj'><tfoot id='i8rHj'></tfoot><dl id='i8rHj'><fieldset id='i8rHj'></fieldset></dl></div>
          <tfoot id='i8rHj'></tfoot>

                  <legend id='i8rHj'><style id='i8rHj'><dir id='i8rHj'><q id='i8rHj'></q></dir></style></legend>
                  本文介紹了ajax php 下拉列表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  有人能告訴我這個網站上的示例代碼有什么問題嗎http://www.x-developer.com/php-scripts/loading-drop-downs-with-ajax-php-and-fetching-values-from-database-without-refreshing-the-page

                  Can some one tell me what's wrong with this example code on this site http://www.x-developer.com/php-scripts/loading-drop-downs-with-ajax-php-and-fetching-values-from-database-without-refreshing-the-page

                  基本上我做的和在 turorial 中完全一樣,問題是第二個下拉列表沒有顯示任何內容.我讀到有人忘記在頁面上添加一些 javascript 的評論之一.我該怎么做?

                  Basically i did exactly the same as in the turorial and the problem is that the 2nd drop down list is no showing anything. I read one of the comments that someone forgot to add in some javascript on the page. How do i do this?

                  我曾嘗試在該網站上發布一個問題,但一周以來沒有人回答,所以我來到了這里.

                  I have tried posting a question on that site but no one answered for a week now so I came here.

                  任何幫助將不勝感激.

                  這是我的 index.php 頁面

                  this is my index.php page

                  <?php
                  include('cn.php');
                  
                  $sql_country = "SELECT * FROM COUNTRY";
                  $result_country = mysql_query($sql_country);
                  
                  echo "<select name='country' onChange='get_cities(this.value)'>"; //get_cities is defined below
                  
                  while($row_country = mysql_fetch_array($result_country))
                  {
                  echo "<option value='".$row_country['id']."'>".$row_country['country']."</option>";
                  }
                  
                  echo "</select>";
                  
                  echo "<select name='city' id='city'></select>"; //We have given id to this dropdown
                  
                  ?>
                  

                  這是我的 get_cities.js 頁面

                  this is my get_cities.js page

                  function get_cities(country_id)
                  {
                  $.ajax({
                     type: "POST",
                     url: "cities.php", /* The country id will be sent to this file */
                     beforeSend: function () {
                    $("#city").html("<option>Loading ...</option>");
                      },
                     data: "country_id="+country_id,
                     success: function(msg){
                       $("#city").html(msg);
                     }
                     });
                   } 
                  

                  這是我的城市.php頁面

                  This is my cities.php page

                  <?php
                  
                  include('cn.php');
                  
                  // Code for cities.php
                  $country_id = $_REQUEST['country_id'];
                  
                  $sql_city = "SELECT * FROM CITY WHERE country_id = '".$country_id."'";
                  $result_city = mysql_query($sql_city);
                  echo "<select name='city'>";
                  
                  while($row_city = mysql_fetch_array($result_city))
                  {
                  echo "<option value='".$row_city['id']."'>".$row_city['city']."</option>";
                  }
                  
                  echo "</select>";
                  
                  ?>
                  

                  包含的cn.php"只是我與數據庫的連接.

                  The included 'cn.php' is just my connection to the database.

                  推薦答案

                  //Index.php
                  <?php
                  $conn = mysql_connect("localhost", "root", "root");
                  $db = mysql_select_db("country_example", $conn);
                  
                  $sql_country = "SELECT * FROM country";
                  $result_country = mysql_query($sql_country);
                  
                  ?>
                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  <html xmlns="http://www.w3.org/1999/xhtml">
                  <head>
                  <title>Country List</title>
                  </head>
                  <body>
                  <?php 
                  
                  echo "<select name='country' onChange='get_cities(this.value)'>";
                  
                  while($row_country = mysql_fetch_array($result_country))
                  {
                      echo "<option value='".$row_country['id']."'>".$row_country['country']."</option>";
                  }
                  echo "</select>";
                  echo "<div id='cityLayer'><select name='city' id='city'></select></div>";
                  ?>
                      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
                      <script type="text/javascript"> 
                      function get_cities($country_id){
                       $.ajax({
                           url : "city.php?country_id="+$country_id,
                           cache : false,
                           beforeSend : function (){
                                //Show a message
                           },
                           complete : function($response, $status){
                               if ($status != "error" && $status != "timeout") {
                                   $('#cityLayer').html($response.responseText);
                               }
                           },
                           error : function ($responseObj){
                               alert("Something went wrong while processing your request.
                  
                  Error => "
                                   + $responseObj.responseText);
                           }
                       }); 
                      }
                   </script>
                  </body>
                  </html>
                  
                  //City.php
                  <?php
                  
                  $conn = mysql_connect("localhost", "root", "root");
                  $db = mysql_select_db("country_example", $conn);
                  
                  $country_id = $_REQUEST['country_id'];
                  $sql_city = "SELECT * FROM cities WHERE country_id = '".$country_id."'";
                  $result_city = mysql_query($sql_city);
                  
                  echo "<select name='city'>";
                  while($row_city = mysql_fetch_array($result_city))
                  {
                      echo "<option value='".$row_city['id']."'>".$row_city['city']."</option>";
                  }
                  echo "</select>";
                  ?>
                  

                  這篇關于ajax php 下拉列表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                  <legend id='arhxR'><style id='arhxR'><dir id='arhxR'><q id='arhxR'></q></dir></style></legend>
                  1. <small id='arhxR'></small><noframes id='arhxR'>

                      1. <i id='arhxR'><tr id='arhxR'><dt id='arhxR'><q id='arhxR'><span id='arhxR'><b id='arhxR'><form id='arhxR'><ins id='arhxR'></ins><ul id='arhxR'></ul><sub id='arhxR'></sub></form><legend id='arhxR'></legend><bdo id='arhxR'><pre id='arhxR'><center id='arhxR'></center></pre></bdo></b><th id='arhxR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='arhxR'><tfoot id='arhxR'></tfoot><dl id='arhxR'><fieldset id='arhxR'></fieldset></dl></div>
                          <tfoot id='arhxR'></tfoot>

                            <tbody id='arhxR'></tbody>
                            <bdo id='arhxR'></bdo><ul id='arhxR'></ul>

                            主站蜘蛛池模板: 亚洲精品国产电影 | 久久人人网 | 狠狠做深爱婷婷综合一区 | 日韩中文一区二区三区 | 99爱在线观看 | 欧美日韩国产精品一区 | 欧日韩不卡在线视频 | a在线免费观看 | 亚洲综合一区二区三区 | 国产一区二区三区免费视频 | 亚洲二区视频 | 自拍亚洲 | 精品在线观看入口 | 亚洲狠狠爱 | 真人毛片 | 国产一区二区欧美 | 欧美在线一区视频 | 亚洲一区二区三区在线视频 | 国产精品久久久久久久久久久免费看 | 欧美三级在线 | 免费一级欧美在线观看视频 | 色视频在线播放 | 国产精品久久久久一区二区三区 | 亚洲久视频 | 91视频电影 | 亚洲电影一区二区三区 | 国产成人综合网 | 久热爱 | 国产精品国产精品国产专区不片 | 夜夜爽99久久国产综合精品女不卡 | av中文字幕在线 | 国产中文字幕网 | 日韩欧美一级 | 97精品超碰一区二区三区 | 美女黄网站视频免费 | 91视频在线 | 99久久精品国产毛片 | 老妇激情毛片免费 | 久久夜视频 | 日韩欧美操 | 欧美色性|