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"). HTML (data); }) }); |
HTML code
The code is as follows |
Copy Code |
<li><span class= "name" ><b>*</b> intention City:</span> <select name= "Yxcs" class= "City" id= "house_city" > <option value= ' 0 ' > Please 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= "Ten" > Fuzhou </option> <option value= "One" > Changsha </option> <option value= "A" > Chengdu </option> <option value= "" > Guiyang </option> <option value= > Kunming </option> <option value= > Qingdao </option> <option value= > Nanchang </option> <option value= > Jiujiang </option> <option value= "A" > Ganzhou </option> <option value= > Dalian </option> <option value= > Datong </option> <option value= > Wenzhou </option> <option value= > Hangzhou </option> <option value= > Ningbo </option> <option value= > Wuhan </option> <option value= > XI ' an </option> <option value= > Hefei </option> <option value= > Changchun </option> <option value= > Harbin </option> <option value= > Urumqi </option> <option value= "Wuyi" > Shenyang </option> <option value= > Shanghai </option> <option value= > Jinan </option> </select> <select name= "yxqy" class= "City" id= "House_area" > <option value= ' 0 ' > Please select </option> </select></li> |
Simple PHP file operation
Just query the database and return to <option value= "1" > Tianxin District </option>.