Repopulate Autoload Dropdown value With Ajax/Jquery |
You want the value selected in one dropdown to limit the choices offered in the other dropdown, so if you select Northern region, for example, the other dropdown shouldn't include cities in Texas and Arizona. Most of the action happens in Javascript, not PHP. I don't know much Javascript (which is what JQuery and Ajax are, basically), so I can't show you specific code, but the general idea is this.
1.- In your controller, load the data for both dropdowns into respective PHP arrays. 2.- Format the data for each dropdown into a string that can be inserted into your Javascript code. See the PHP docs for implode. Code: In PHP: It's not a tutorial, but stackoverflow.com usually has some good answers. This may work. http://stackoverflow.com/questions/20483...enu-values
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
|
Messages In This Thread |
Repopulate Autoload Dropdown value With Ajax/Jquery - by Codeigniter_Learner - 12-27-2015, 06:41 AM
RE: Autoload Dropdown With Ajax/Jquery - by RobertSF - 12-27-2015, 02:20 PM
RE: Autoload Dropdown With Ajax/Jquery - by Codeigniter_Learner - 12-30-2015, 02:55 AM
RE: Autoload Dropdown With Ajax/Jquery - by John_Betong - 12-27-2015, 05:34 PM
RE: Autoload Dropdown With Ajax/Jquery - by Codeigniter_Learner - 12-30-2015, 02:57 AM
RE: Repopulate Autoload Dropdown value With Ajax/Jquery - by RobertSF - 12-30-2015, 09:58 AM
|