0

I am trying to make the Bootstrap3 modal to work via Ajax Load using CodeIgniter. I've tried this but it's still not working. It's so simple to use when I follow what's in the docs but I want it to be via ajax load just like what I did for bootstrap 2.3.2. I am trying to figure it out for a couple of days but with no luck.

Here's my code:

View:(the one that triggers the modal)

<li role="presentation">
   <a data-toggle="modal" href="<?php echo $this->config->item('Ompty_URL'); ?>/edit" data-target="#myModal">Edit Information</a>
</li>

Controller:

function edit(){
   $this->load->view('system/modals/edit_form');
}

View:(the content of my modal)

<!-- Modal -->
<div class="modal fade" id="myModal" 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" aria-hidden="true">&times;</button>
             <h4 class="modal-title">Modal title</h4>

        </div>
        <div class="modal-body"><div class="te"></div></div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <button type="button" class="btn btn-primary">Save changes</button>
        </div>
    </div>
    <!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->

Can somebody help me?

Community
  • 1
  • 1
elimariaaa
  • 796
  • 4
  • 10
  • 30

1 Answers1

0

Your modal wrappers id doesn't match your links data-target.

Change:

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

to:

<div class="modal fade" id="terms" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

Hope this helps!

Rwd
  • 34,180
  • 6
  • 64
  • 78
  • Thanks for the answer. Yeah, I already edited my code but with no luck. Still not working. – elimariaaa Dec 16 '14 at 12:21
  • I've made an improvement. My modal is showing but the CSS is a mess. The modal is not centered and I can't click it. – elimariaaa Dec 16 '14 at 13:16
  • That sounds like it would have to be put in a completely different question as there are multiple different possibilities as to why that would happen. – Rwd Dec 16 '14 at 13:31