I have a bootstrap (2.3.2) modal defined as this:
<div id="myModal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<a href="#" class="btn">Close</a>
<a href="#" class="btn btn-primary">Save changes</a>
</div>
</div>
I also have a button like this:
<button type="button" data-toggle="modal" data-remote="index.php/mycontroller/methodname" data-target="#myModal">Launch modal</button>
method in controller:
public function methodname() {
$this->load->view('modalbody');
}
If I directly use browser to access: localhost/myproject/index.php/mycontroller/methodname I can get the html without any problem, but if I click on the button, I got an 500 internal server error . Why and how to fix this?
Edit: when the modal is loaded I don't see my html got injected inside 'modal-body'. Also I digged a little deeper (by using firefox + firebug) and the internel error was 'The action you have requested is not allowed.' (when using google chrome it didn't show any detailed error msg) which has something to do with csrf_protection (I have set this to true). So which means when calling this modal, I have to pass the csrf token name and hash (ie. by using $this->security->get_csrf_token_name();), but I have looked at the bootstrap js source code, data-remote is simply calling the jQuery load function:
.load(this.options.remote)
without accepting any data, so how am I going to pass the csrf token name and hash????