[eluser]Wondering Coder[/eluser]
Current view
Code:
[removed]
$(document).ready(function() {
$('#submit_message').click(function() {
var msg = $('#message').val();
$.post("<?php echo site_url('messaging/add') ?>", {message: msg}, function() {
$('#wrap').load("<?php echo site_url('messaging/view/ajax') ?>");
$('#message').val('');
});
});
});
[removed]
My controller function
Code:
function view($type = NULL)
{
$data['title'] = 'Messaging';
$data['user_id'] = $this->userid();
$data['role_id'] = $this->roleid();
$data['messages'] = $this->user_restriction();
$data['replies'] = $this->messaging_db->get_replies();
$data['image'] = $this->messaging_db->get_logged_user($this->userid(),$this->roleid());
$data['modules'] = $this->dataset_db->getModules($this->load_module());
if ($type == "ajax")
{
$data['content'] = $this->load->view('panes/messaging_list', $data);
}
else
{
$data['content'] = $this->load->view('panes/messaging', $data, true);
$this->load->vars($data);
$this->load->view('template');
}
$this->output->enable_profiler(TRUE);
}
I want to modify my view to call this url:
Code:
$('#wrap').load("<?php echo site_url('messaging/view/add/ajax') ?>");
I know that if I have to change my url to this, I will also have to modify my controller function view. Just don't know how to achieve this.
The reason why I want the url to be in segment 4 coz I'm using a pagination which is in segment 3 and its throwing me an error in firebug since I'm using both segment in 3.
this is the error:
Quote:A Database Error Occurred
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ajax,5' at line 17
SELECT messaging_id as pkey, messaging_id, messaging_poster_id, messaging_role_id, parent_id, messaging_no_replies, messaging_content, last_post_datetime, pps_a.display, DATE_FORMAT(messaging_date_posted, '%W, %b %e, %Y at %h:%i %p')messaging_date_posted3, pps_c.data_value, pps_c.data_display, b.fullname,b.image, b.coor_id
FROM (pps_messaging pps_a)
LEFT JOIN (
SELECT user_id, coor_id, data_id, image, fullname
FROM ( SELECT ad_userid user_id, '' coor_id, ad_dataid data_id, image,concat_ws(' ',fname,mname,lname) as fullname FROM pps_admin_users
UNION
SELECT user_id, coor_id, data_id, image,concat_ws(' ',fname,mname,lname) as fullname FROM pps_users) uni ) b ON messaging_poster_id=b.user_id AND messaging_role_id=b.data_id
LEFT JOIN pps_dataset pps_c ON messaging_role_id=pps_c.data_id
WHERE parent_id=0
ORDER BY messaging_id DESC
LIMIT ajax,5
Filename: C:\apache2.2\htdocs\dcs-pps\system\database\DB_driver.php
Line Number: 330