gpt4 book ai didi

php - 使用 ajax Php 和 mysql 级联下拉菜单

转载 作者:行者123 更新时间:2023-11-29 12:01:04 24 4
gpt4 key购买 nike

我正在创建类似的东西,但下拉菜单之一出现问题。通过视频您可以更好地理解

Video for the reference

here the source code file

here the tutorial link

最佳答案

每次接收 AJAX 数据时,您总是将其添加到下一个下拉列表中。但是,您在执行此操作之前并未清除下拉列表,因此您也会获得之前的项目。

例如,要修复“类型”->“模型”下拉菜单的问题(如视频中所示),您应该使用 empty() 调用来启动 populateModel()像这样:

function populateModel(xmlindata) {

var mySelect = $('#printermodel');;
mySelect.empty();

关于php - 使用 ajax Php 和 mysql 级联下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32368740/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com