问题描述
我有一个具有相关下拉列表的表格,例如品牌,类别和产品,对于单行,我拥有3个Ajax请求响应中的所有3个列表,但是在新行中使用addrow如何调用或获取3个不同的Ajax响应值不到一个?
例如基于品牌类别的
$.ajax({
url: 'php_action/fetchDropdownProductData.php',// category depend on brand name
type: 'post',data: {brandId : brandId},dataType: 'json',success:function(response) {
var html = '<option value="">Select Category</option>';
response.forEach(category => {
html += "<option value='" + category.categories_id + "'>"+ category.categories_name +"</option>"
$("#productCategories"+row).html(html);
})
} // /success
}); // /ajax function to fetch the product data
以及用于addrow ajax
$.ajax({
url: 'php_action/fetchProductData.php',type: 'post',success:function(response) {
$("#addRowBtn").button("reset");
var tr = '<tr id="row'+count+'" class="'+arrayNumber+'">'+
// start of productBands on addrows
'<td>'+
'<div class="form-group">'+
// here is the wrong I am doing...
'<select class="form-control" name="productBrand[]" id="productBrand'+count+'" onchange="getProductData1('+count+')" >'+
'<option value="">~~SELECT~~</option>';
$.each(response,function(index,value) {
tr += '<option value="'+value[0]+'">'+value[1]+'</option>';
});
tr += '</select>'+
'</div>'+
'</td>'+
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)