public function comment_text() { // Get the application object. $app = JFactory::getApplication(); $comment = JRequest::getString("comment", "", "default", 2); $commenter_id = JRequest::getInt("commenter_id"); $text_id = JRequest::getInt("text_id"); $writer_id = JRequest::getInt("writer_id"); $success = ideary::addComment($commenter_id, $text_id, $comment, $writer_id); $commentId = ideary::getLastInsertedCommentId(); echo json_encode(array('success' => $success, 'comment_id' => $commentId)); $app->close(); }