下拉列表ajax

Can some one look over my code and see what is causing the second drop down to not be populating? I am not quite sure why. Thank you in advance.

View:

    <div id="finder">
    <div class="form">
    <select id="brand" name="brand" onchange="myFunction()" >
        <option value="">&nbsp;&nbsp;- Printer Brand -&nbsp;&nbsp;</option>
        <?php foreach ($categories as $category_1) { ?>
        <?php if ($category_1['category_id'] == $category_id) { ?>
        <option value="<?php echo $category_1['category_id']; ?>" selected="selected"><?php echo $category_1['name']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $category_1['category_id']; ?>"><?php echo $category_1['name']; ?></option>
        <?php } ?>
        <?php } ?>
    </select>
    </div>

    <br>

<div class="form">
    <select name="printerSeries" id="printerSeries">
    <option value="">&nbsp;&nbsp;- Printer Series -&nbsp;&nbsp;</option>

    </select>
  </div>
  <br>

Javascript ajax call

<script type="text/javascript">
function myFunction(){
var brand_id = document.getElementById("brand").value;
        $.ajax({
        url: 'index.php?route=common/home/getSeries&brand_id=' + brand_id, 
        type: 'post',
        dataType: 'json',
        success: function(json) {
            $('#printerSeries').append('<option value="<?php echo $json['category_id']; ?>"  Selected="selected"><?php echo $json['name']; ?></option>');
        
        }
        error: function(){
            alert('error');
        }       
    });

}
</script>

Here is the controller function that receives the json request

    public function getSeries($brand){
$brand_id = $_POST['brand_id'];
$json = array();
$categories_2 = $this->model_catalog_category->gettoner($brand_id);

    foreach ($categories_2 as $category_2) {

        $json = array(
            'category_id' => $category_2['category_id'],
            'name'        => $category_2['name'],
        );


}
    $this->response->addHeader('Content-Type: application/json');
    $this->response->setOutput(json_encode($json));


    }
</div>

Here the problem may be caused by the folowing function: $this->model_catalog_category->gettoner($brand_id);

Check to see whether the function returns a value in every situation. If not, simply return any value.Your dropdown menu will appear.