I want to create comments using jquery , this is the php file that ajax calls :
require_once '../Classes/MainController.php';
$mc = MainController::getInstance();
foreach ($mc->getThreadComments($_POST['thread_id']) as $comments)
print json_encode($comments);
This is the output from the ajax call (2 comments):
{
"0": "6",
"id": "6",
"1": "10",
"user_id": "10",
"2": "3",
"thread_id": "3",
"3": "ba nu fii nebuuun cum e piesa asta !",
"comment": "Damn son, this is the shit!"
} {
"0": "7",
"id": "7",
"1": "10",
"user_id": "10",
"2": "3",
"thread_id": "3",
"3": "Omg this hits so fucking hard , bass too stronk !",
"comment": "Omg this hits so fucking hard , bass too stronk !"
}
And I want to convert this into html , somthing like :
<div class="large-2 columns small-3"><p> User id </p></div>
<div class="large-10 columns"><p > Comment </p></div>
How would the script look like , if I would like it to loud automatically once the page is loaded ? I know it has something to do with each() , but I don't really know how to use it.