问题描述
我有两个下拉菜单.当我选择第一个.第二个数据库应该根据第一个数据库的选定值从数据库中填充.我不想提交然后获取值,所以基本上没有页面刷新.为此我需要jquery和Ajax吗?
I have two drop downs. when I select the first one . The second one should be populated from the database based on the value selected of the first one. I don't want submit and then get the value , so basically no page refresh.Do I need jquery and Ajax for this?
推荐答案
虽然并非严格要求jQuery和AJAX,但如果您想快速地做到这一点,并且希望以后的开发人员知道发生了什么,那么它们就是必需的.第一个下拉菜单应触发onChange,以通过AJAX在JSON列表中提取第二个下拉菜单的内容,并自动填充第二个下拉菜单.
though jQuery and AJAX aren't strictly required, they are if you want to do this quickly and in a way that future developers know what's going on.the first drop-down should fire onChange to pull the contents of the second drop-down via AJAX in a JSON list and auto-populate the second drop-down.
这篇关于两个动态下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!