您好,登錄后才能下訂單哦!
如何使用Jquery,Ajax,PHP和Mysql進行動態(tài)相關(guān)選擇框。 當在“父”框中進行選擇時,從屬選擇框允許刷新“子”框列表數(shù)據(jù)。 在這篇文章中,我給出了“catergory”和“subcategory”之間的數(shù)據(jù)庫關(guān)系示例。 這是非常簡單的jquery代碼,希望大家喜歡。
數(shù)據(jù)庫
示例數(shù)據(jù)庫表。 Data 包含列表框的完整數(shù)據(jù), data_parent 的key關(guān)系與 Data 包含父子關(guān)系。
sections_demo.php
包含javascipt和PHP代碼。
$(“。country”)。change(function(){}
-
country
是select box的類名。使用
$(this).val()
調(diào)用select box值.PHP代碼顯示
Data
中的
結(jié)果,
其中
weight =' 1'
ajax_city.php
包含PHP代碼。
顯示
data
和
date_parent
表的結(jié)果
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。