how to put a whole output of a view into a element of a JSON object?
My task is to save replay of user once submited and update the view, where we can see latest replay. for this i am using post method
$.post(url, dataString, function(data) {
if(data.error_message != '') $(".forum_replay").html(data.content);
// some thing
},"json");
In controller, i am saving data if there is no error.and then i wan开发者_开发百科t to update the view
$content = $this->load->view( $this->config->item('View_forum_replies') );
$json_data = array('error_message' => $message,
'$content' => $content);
echo json_encode($json_data);
you have an error right here:
'$content' => $content
you need to drop the $ from the first portion
you might also want to change
if(data.error_message != '')
to
if(data.error_message == '')
精彩评论