Problem with passing values to bootstrap modal window

I am just start creating a database update system with a bootstrap modal window. I am using ajax to populate the modal form fields but not getting any value. Please review the code and help me to figure out the error.

<!-- Modal -->
        <div class="modal fade" id="edit_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">Edit Data</h4>
                  <div class="modal-body">
                      <div class="content-wrapper content-wrapper--with-bg">
                      <?php echo form_open('quotation'); ?>
                            <input type="text" name="bname" id="bname" required class="form-control custom-ctrl" placeholder="Billing Name">
                           <span class="text-danger"><?php echo form_error('bname'); ?></span>
                            <input type="text" name="company" id="company" required class="form-control custom-ctrl" placeholder="Company">
                           <span class="text-danger"><?php echo form_error('company'); ?></span>
                            <input type="hidden" name="id" id="id"> 
                            <button type="submit" id="update" class="btn btn-primary btn-custom pull-right"> Update</button>
                        <?php echo form_close(); ?>

My Controller Function

public function fetch_by_id(){
    $result = $this-&gt;quotation_model-&gt;fetch_by_id();
echo json_encode($result);

And Here is the Modal associated with the controller.

public function fetch_by_id(){
    $id = $this-&gt;input-&gt;get('id');
    $this-&gt;db-&gt;where('id', $id);
    $query = $this-&gt;db-&gt;get('quotes');
return $query-&gt;result();

Here is the ajax code

$(document).on('click', '.editBtn', function(){
   var id = $(this).attr('data');

       type: 'ajax',
       method: 'get',
       url: '&lt;?php echo base_url(); ?&gt;quotation/fetch_by_id',
       data: {id: id},
       async: false,
       dataType: 'json',
       success: function(data){
       error: function(){
           alert('Could not displaying data');

I am just able to popup the modal window but not getting any value

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.