This article mainly introduces jQuery's information on how to implement linkage between infinitus regions based on BootStrap styles. For more information, see the HTML section.
Js Section
Script // obtain ajax data for the first time $. get ("http: // 127.0.0.1: 83/areas/sec", {id: '0'}, function (data) {var option ="Select"; Var list = data. data; for (var key in list) {// console. log (key); // console. log (data [key]. areaname); option + =""+ List [key]. areaname +""Commandid certificate ('{main'}.html (option) ;}, 'jsonp'); function change (event) {$ ('. select '). each (function (I) {// clear the old node console after the reselection. log ($ (event ). attr ('num'); if ($ (this ). attr ('num')> $ (event ). attr ('num') {$ (this ). parent (). remove () ;}) var sel = $ ('. select '). index ($ (event) + 1; var id = $ (event ). val (); $. ajax ({type: "get", dataType: "jsonp", url: "http: // 127.0.0.1: 83/areas/sec", data: {id: id }, sync: false, // set to synchronize success: function (data) {console. log (data); var list = data. dataif (data. state = '1') {var option ="Select"; For (var key in list) {option + =""+ List [key]. areaname +"";}// ('{Tmp'}.html (option); // tmp = option $ (''+ Option +'
'). AppendTo (' # Region') ;}});} script
The data returned by the backend is
{State: 1, data: {1: {areaname: "Hohhot" id: "150100" level: "2" pid: "150000 "}...}}
For more jQuery articles on how to implement linkage between infinitus regions based on the BootStrap style, refer to the PHP Chinese website!
Related Articles:
Detailed description of Bootstrap's pure CSS3 arrow button style
Detailed description of Bootstrap Implementation of beautiful and concise CSS3 price list instance source code
Use Bootstrap form to create instance code