Reputation: 6136
I'm loading a view, extra.php
, into #extra
div via jquery command:
$('#extra').html("<?php $this->load->view('extra'); ?>");
extra.php
is a long file, and jquery.html()
loads only a single line of code
for example, it loads fine:
<table><tr></tr><tr></tr><tr></tr></table>
but it doesn't load at all:
<table>
<tr>....</tr>
<tr>....</tr>
<tr>....</tr>
</table>
How to fix it?
Upvotes: 1
Views: 623
Reputation: 6136
Ok guys, I found some extra solution on codeigniter board, it's simply hilarious:
http://codeigniter.com/forums/viewthread/219780/
: )
Upvotes: 1
Reputation: 5000
You need to escape each line that is output from the view, that way you can pass a multi-line string to the function. To escape, you just need to append a \
to the end of each line so that you would have the following:
$('#extra').html("<table>\
<tr>....</tr>\
<tr>....</tr>\
<tr>....</tr>\
</table>");
You can see it working on jsfiddle.
Upvotes: 0