unemployment Posted January 22, 2012 Share Posted January 22, 2012 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); } Quote Link to comment https://forums.phpfreaks.com/topic/255526-phpajax-for-messaging-system/ Share on other sites More sharing options...
jcbones Posted January 22, 2012 Share Posted January 22, 2012 What is the error? json_last_error Quote Link to comment https://forums.phpfreaks.com/topic/255526-phpajax-for-messaging-system/#findComment-1310119 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.