Jump to content

PHP/Ajax For Messaging System


unemployment

Recommended Posts

In my ajax php file for my messaging system I’m trying to get my pagination to work properly  when sending an ajax request.  I don’t know how to do it though.  I’m trying to pass through the HTML generated from the php class into a JSON encoded array object.  When I do this, I get a JS error. 

 

Here is the code below:

 

if (isset($user_info['uid'], $_GET['id'], $_GET['page'], $_GET['s']) && $_GET['s'] === session_id())
{	
delete_conversation($_GET['id']);

$total 					= fetch_total_conversations();
$conversations 			= fetch_conversations($_GET['page'], 20);

foreach($conversations as $k => $r)
{ 
	$conversations[$k]['last_message'] = time_since_tstamp($r['last_message']).' ago';
}

$pages = new Paginator();  
$pages->items_total = $total;  
$pages->mid_range = 9;  
$pages->paginate(20);

$conversations['pagination'] = $pages->display_pages();

//print_array($conversations);
echo json_encode($conversations);
}

Link to comment
https://forums.phpfreaks.com/topic/255526-phpajax-for-messaging-system/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.