In one of my View, i have a modal popup containing 2 dropdown lists (ddlPublications & ddlEditions).On page load, ddlPublications will be populated while ddlEditions will remain empty.However, ddlEditions will be populated on the onchange event of ddlPublications.
View
<div class="modal-body" style="height: 100%;">
    <div class="col-md-12">
        <div class="form-group">
            <label>Publication</label>
            <select id="ddlPublication" name="ddlPublication" class="form-control" onchange="load_editions(this.value)">
                <option value="0">--select--</option>
                <?php
                    foreach ($pub_data as $key => $pdata) {
                ?>
                    <option value="<?php echo $pdata['pub_id'];?>"> <?php echo $pdata['pub_title'];?> </option>
                <?php
                    }
                ?>
            </select>
        </div>
    </div>
    <div class="col-md-12">
        <div class="form-group">
            <label>Edition</label>
            <div id="edn_div_data">
                <select id="ddlEdition" name="ddlEdition" class="form-control">
                    <option value="0">--Select--</option>
                </select>
            </div>
        </div>
    </div>
</div>
<script>
    function load_editions(pub_id){
        alert(pub_id);
        var p_id = pub_id;
        $.ajax({
            type: "POST",
            url: "<?php echo base_url(); ?>pmachine/pages/get_editions/"+pub_id,
            dataType: 'json',
            success: function(result){
                $("#edn_div_data").html(result);
            },
            error: function(result) {
                $("#edn_div_data").html("Sorry, something went wrong");
            }
        });
    }
</script>
CONTROLLER
public function get_editions($pubid)
{
    $data['edn_data'] = $this->Process_pages_model->pop_editions($pubid);
    echo json_encode($data);
}
Problem
ddlEditions is not getting populated.It shows the message 'Sorry, something went wrong'.Please suggest what's wrong with my code.
 
     
     
     
    