I am sending HTML code to ajax, and appending this code to the bottom of a list. Its for ajax paginating.
The code returned starts with
<?php<?php<?php<?php
and ends with
[1]
what I am send is an array of html formatted activity items. This is an example of what I am getting back in ajax.
<?php<?php<?php<?php
<div class="activity">
<div class="activity-top"></div>
<div class="activity-body"></div>
</div>[1]
the item I am sending IS in an array.
the function returning code to looks like
function run_loop() {
$each_item = array();
if( has_activities( array('current_page' => $_POST['this_page'], 'user_id' => $_POST['user_id'] ) ) ) {
while ( activity() ) : the_activity();
$each_item[] = include( dirname(dirname(__FILE__)).'/activity/activity-entry.php' );
endwhile;
}
exit(json_encode($each_item));
}
Additionally, I tried working with the html code despite it being broken, and the parent div (container for activity) returned is not displayed. I am using .append()
.