使用php + mysql和jquery ajax post填充三个后续选择列表

Ok I've chainged script, this is now the code of index file:

<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.js"></script>

<script type="text/javascript">
    jQuery(document).ready(function(){              

        jQuery("select[name='brand']").change(function(){               

            var brandValue = jQuery("select[name='brand']").val();     

            jQuery.ajax({
                type: "POST",
                url: "handler.php",
                data: ({brand: brandValue, status: 1}),
                beforeSend: function(){ jQuery("#loader").show(); },
                complete: function(){ jQuery("#loader").hide(); },
                success: function(response){
                    jQuery("#results").html(response);
                    jQuery("#results").show();
                }
            });         
        });

        jQuery('body').on('change','select[name="series"]',function(){               

            var seriesValue = jQuery("select[name='series']").val();
            var brandValue = jQuery("select[name='brand']").val();     

            jQuery.ajax({
                type: "POST",
                url: "handler.php",
                data: ({series: seriesValue, brand: brandValue, status: 1}),
                beforeSend: function(){ jQuery("#loader").show(); },
                complete: function(){ jQuery("#loader").hide(); },
                success: function(response){
                    jQuery("#results").html(response);
                    jQuery("#results").show();
                }
            });         
        });

        jQuery('body').on('change','select[name="models"]',function(){               

            var modelsValue = jQuery("select[name='models']").val();
            var seriesValue = jQuery("select[name='series']").val();
            var brandValue = jQuery("select[name='brand']").val();

            jQuery.ajax({
                type: "POST",
                url: "handler.php",
                data: ({models: modelsValue, series: seriesValue, brand: brandValue, status: 1}),
                beforeSend: function(){ jQuery("#loader").show(); },
                complete: function(){ jQuery("#loader").hide(); },
                success: function(response){
                    jQuery("#results").html(response);
                    jQuery("#results").show();
                }
            });         
        });

    });
</script>

Brands: 
<select name="brand">
    <option value="">Please Select</option>
<?php
$brands = get_brands();
foreach($brands as $brand) {
    ?>
    <option value="<?php echo $brand['brand_id']?>"><?php echo $brand['brand_name']; ?></option>
    <?php
}
?>
</select>

<div id="results" style="display:none;"></div>

<div id="loader" style="display:none;"><img src="ajax-loader.gif" alt="loading..."></div>

and this is procesing file:

<?php
if(!empty($_POST['brand'])) {
    $curentSeries = get_series($_POST['brand']);
    ?>

    Series: 
    <select name="series">
        <option value="">Please Select</option>
        <?php
        foreach($curentSeries as $ser) {
            ?>
            <option value="<?php echo $ser['series_id']; ?>"><?php echo $ser['series_name']; ?></option>
            <?php 
        }
        ?>
    </select>
    <?php
}
?>

<?php
if(!empty($_POST['series'])) {
    $curentModels = get_models($_POST['brand'], $_POST['series']);
    ?>

    Model: 
    <select name="models">
        <option value="">Please Select</option>
        <?php
        foreach($curentModels as $model) {
            ?>
            <option value="<?php echo $model['model_id']; ?>"><?php echo $model['model_name']; ?></option>
            <?php 
        }
        ?>
    </select>
    <?php
}
?>

<?php
if(!empty($_POST['models'])) {
    echo "<br />brand: {$_POST['brand']}<br />series: {$_POST['series']}<br />model: {$_POST['models']}";
}

script is working now, we figured it out, final issue was in the processing file, as i sorted it out, all is fine now

Since your 'series' data is created dynamically , you need to use 'on' event in jquery.Check following code

<script type="text/javascript">
    jQuery(document).ready(function(){              

    jQuery("select[name='brand']").change(function(){               

        var optionValue = jQuery("select[name='brand']").val();     

        jQuery.ajax({
            type: "POST",
            url: "data.php",
            data: ({brand: optionValue, status: 1}),
            beforeSend: function(){ jQuery("#loader").show(); },
            complete: function(){ jQuery("#loader").hide(); },
            success: function(response){
                jQuery("#series").html(response);
                jQuery("#series").show();
            }
        });         
    });

    jQuery('body').on('change','select[name="series"]',function(){               

        var seriesValue = jQuery("select[name='series']").val();     

        jQuery.ajax({
            type: "POST",
            url: "data.php",
            data: ({series: seriesValue, status: 1}),
            beforeSend: function(){ jQuery("#loader").show(); },
            complete: function(){ jQuery("#loader").hide(); },
            success: function(response){
                jQuery("#model").html(response);
                jQuery("#model").show();
            }
        });         
    });

     });
  </script>