jQuery Ajax population of dropdowns
jQuery Ajax population of dropdowns
我对 ajax 的 3 个下拉列表的动态种群有问题
$.ajax({
url:"loadPersons",
success:function(data) {
loadPersons(data);
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
这是我的另一个阿贾克斯
$.ajax({
url:"loadCars?personId=8796093056989",
data:{"personId":personId},
success:function(data) {
loadCars(data);
},
error: function (xhr, ajaxOptions, thrownError) {
}
第一个返回所有人,第二个应返回具有指定ID的人的汽车。但是,当我按下第一个下拉菜单中的某些内容时,所有对象都会进入第二个下拉列表。您知道如何进行过滤吗?
你不应该使用类似的东西吗
url:"loadCars?personId="+$('#persons-ddl').val()
?
将第二个 ajax 调用更改为:
$.ajax(
{
url:"loadCars",
data:
{
"personId":personId // this is the id of the selected person in your person combobox
},
error: function (xhr, ajaxOptions, thrownError)
{
}
}).done(function(data)
{
loadCars(data);
});
相关文章:
- HighChart : Usage of setData
- Difference between methods of defining JavaScript 'class
- 为什么我在下面的..of循环中得到意外令牌
- Appending the innerhtml of <th>
- Animation cuts off multiple lines of text in <p>
- javascript: functionname() instread of functionname()
- jQuery使用.of()删除事件处理程序时出现的问题
- Three.js issue creating meshes outside of loader's load(
- jquery in the middle of html
- JavaScript equivalent of C#'s DynamicObject?
- nodejs console.log of object
- value of jquery sortable
- Javascript imageData returns array of 0's
- 对于grunt构建中的(let.of)错误
- Opposite of jQuery's :eq()
- Implementation of jQuery 'animate' with Meteor
- 当调用.of()然后调用.on()时,Jquery是否可能将事件推迟
- Angularjs ng-options selected value of dropdownlist
- Java eqivalent method of “splice(a,b,..)“在 JavaScript 方法中
- jQuery Ajax population of dropdowns