Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Ajax冲突-关于如何解决冲突的建议_Javascript_Jquery_Ajax - Fatal编程技术网

Javascript Ajax冲突-关于如何解决冲突的建议

Javascript Ajax冲突-关于如何解决冲突的建议,javascript,jquery,ajax,Javascript,Jquery,Ajax,我需要关于在哪里找到与AJAX和Javascript冲突的建议。当我隔离4个下拉框时,代码按预期运行。但是,在我的站点上,它只从数据库的第一个下拉列表中提取列表,而不会触发第二个下拉列表的onchange命令 我试过用谷歌搜索各种不同的问题,但我找不到答案。我还回顾了chrome开发工具,我可以看到它调用了第一个ajax请求,但没有触发第二个请求 <script> $(document).ready(function(){ $('#manufacturer').on(

我需要关于在哪里找到与AJAX和Javascript冲突的建议。当我隔离4个下拉框时,代码按预期运行。但是,在我的站点上,它只从数据库的第一个下拉列表中提取列表,而不会触发第二个下拉列表的onchange命令

我试过用谷歌搜索各种不同的问题,但我找不到答案。我还回顾了chrome开发工具,我可以看到它调用了第一个ajax请求,但没有触发第二个请求

    <script>
    $(document).ready(function(){
$('#manufacturer').on('change', function(){
    var manuID = $(this).val();
    if(manuID){
        $.ajax({
            type:'POST',
            url:'ajax.php',
            data:'manu_id='+manuID,
            success:function(html){
                $('#manumodel').html(html);
                $('#manuyear').html('<option value="">Select state first</option>'); 
            }
        }); 
    }else{
        $('#manumodel').html('<option value="">Select country first</option>');
        $('#manuyear').html('<option value="">Select state first</option>'); 
    }
});

$('#manumodel').on('change', function(){
    var manumodelID = $(this).val();
    if(manumodelID){
        $.ajax({
            type:'POST',
            url:'ajax.php',
            data:'manumodel_id='+manumodelID,
            success:function(html){
                $('#manuyear').html(html);
            }
        }); 
    }else{
        $('#manuyear').html('<option value="">Select state first</option>'); 
    }
});
});

$(文档).ready(函数(){
$(“#制造商”)。在('change',function()上{
var manuID=$(this.val();
国际单项体育联合会(manuID){
$.ajax({
类型:'POST',
url:'ajax.php',
数据:'manu_id='+manuID,
成功:函数(html){
$('#manumodel').html(html);
$('#manuyear').html('Select state first');
}
}); 
}否则{
$('#manumodel').html('选择国家优先');
$('#manuyear').html('Select state first');
}
});
$('#manumodel')。关于('change',function()){
var manumodelID=$(this.val();
if(manumodelID){
$.ajax({
类型:'POST',
url:'ajax.php',
数据:'manumodel_id='+manumodelID,
成功:函数(html){
$('#manuyear').html(html);
}
}); 
}否则{
$('#manuyear').html('Select state first');
}
});
});

那么您发布的代码本身就可以工作,但是当它被合并到其他代码中时就不工作了?我们应该如何猜测其他代码正在做什么来干扰它?我的猜测是,在此代码运行后,您站点上的其他东西正在替换
manumodel
元素。尝试使用事件委派: