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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.