Today, we are working on the effect of user data submission. We will use the second-level urban linkage effect in the middle. If we find that a website is doing well, we will use it for your reference.
Jquery code
The Code is as follows: |
Copy code |
$ (Document). ready (function (){ $ ("# House_city"). change (function (){ Var val = $ (this). val (); $. Post ("/ajax/city_ajax", {id: val}, function (data ){ $ ("# House_area" pai.html (data ); }) }); |
Html code
The Code is as follows: |
Copy code |
<Li> <span class = "name"> <B> * </B> intended City: </span> <Select name = "yxcs" class = "city" id = "house_city"> <Option value = '0'> select </option> <Option value = "1"> Suzhou </option> <Option value = "2"> Nantong </option> <Option value = "3"> Changzhou </option> <Option value = "4"> Nanjing </option> <Option value = "5"> Wuxi </option> <Option value = "6"> Xuzhou </option> <Option value = "7"> Jinhua </option> <Option value = "8"> Suqian </option> <Option value = "9"> Chongqing </option> <Option value = "10"> Fuzhou </option> <Option value = "11"> Changsha </option> <Option value = "12"> Chengdu </option> <Option value = "13"> Guiyang </option> <Option value = "14"> Kunming </option> <Option value = "15"> Qingdao </option> <Option value = "16"> Nanchang </option> <Option value = "17"> Jiujiang </option> <Option value = "18"> Ganzhou </option> <Option value = "19"> Dalian </option> <Option value = "20"> Datong </option> <Option value = "21"> Wenzhou </option> <Option value = "22"> Hangzhou </option> <Option value = "23"> Ningbo </option> <Option value = "24"> Wuhan </option> <Option value = "25"> Xi'an </option> <Option value = "26"> Hefei </option> <Option value = "27"> Changchun </option> <Option value = "28"> Harbin </option> <Option value = "29"> Urumqi </option> <Option value = "51"> Shenyang </option> <Option value = "52"> Shanghai </option> <Option value = "53"> Jinan </option> </Select> <Select name = "yxqy" class = "city" id = "house_area"> <Option value = '0'> select </option> </Select> </li> |
Simple PHP File Operation
You only need to query the database and then return <option value = "1"> Tianxin </option>.