Hey guys,
I was able to pull this result from ajax in json format and print it on an html
[{"id":"207","Title":"Test","GenreName":"Action","EntryDate":"2014-05-06 19:13:14"}]
Now I cant figure out how to diplay this data in a table, with each columns for Id, Title, GenreName and EntryData. I cant find sample codes from google either. Or at least I cant comprehend what I saw there,.
Also if you'll notice the result have [] on it, on other examples I dont see Json format having that kind of style, I dont know where it came from since my controller only did echo the data from the model.
AJAX
$('form.ajaxForm').on('submit',function() {
$.ajax({
type: 'POST',
url: 'http://localhost/AnimeInventory/index.php/maincontroller/testForAjax',
data:{ search: $("#searchInput").val(), searchType: $("#searchTypeID").val() },
dataType: 'JSON',
success: function(smg) {
}
});
});
return false;
CodeIgniterController
public function testForAjax(){
echo json_encode($this->inventoryModel->search());
}
Thanks,