Hello,
I would like to use JSON in my project, I am new to this and I am still stuck:
CONTROLLER
$relatedMedia['relatedMedia'] = $this->collmedia_model->getCollectionPreviews( $offset, 8, current_category() );
MODEL
function getJSONCollectionPreview( $offset, $per_page, $mediaType ) {
$result = $this->db->query(" .... " )->result();
// the query is not the problem
$response = $_POST["jsoncallback"] . "(" . json_encode($result) . ")";
echo $response;
}
VIEW
[removed]
$(function() {
console.log ( 'before' );
//retrieve comments to display on page
$.getJSON("http://localhost:8888/cedh/codeigniter/photo?jsoncallback=?", function(data) {
console.log ( 'line' );
}
});
});
[removed]
And in Firebug I have this information :
before
GET http://localhost:8888/cedh/codeigniter/photo?jsoncallback=jsonp1236651123498&_=1236651123664
http://localhost:8888/cedh/codeigniter/photo?jsoncallback=jsonp1236651123498&_=1236651123664
200 OK 84ms
jquery-1....1.min.js (line 19)
syntax error
[Break on this error] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML...3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n
I have no idea how to really implement the JSON, I tried several things tonight, but still get this error message.
I am loooost ![]()
