I am working within the codeigniter framework and on page load making the following ajax request:
$.ajax({
url: '/beta/images/loadImages',
type: 'POST',
dataType: 'json',
data: {id: id},
success: function(json, textStatus, xhr) {
alert('success');
}
}, error: function(json, textStatus, errorThrown) {
alert(errorThrown);
}
});
strong text
public function loadImages()
{
$galleryID = $this->input->post('id');
$data = array('images' => $this->image_gallery->get_slideImages($galleryID) );
echo json_encode($data);
}
Finally the model
public function get_slideImages($galleryID)
{
$this->db->select('id');
$this->db->where('galleryID', $id);
$query = $this->db->get('image_images');
$result = $query->result();
return $result;
}
JSON Return in Chrome
{"images":[{"id":"34","galleryID":"57","clientRef":"205","imageName":"769074051374530545.jpg","orgName":"P9180021.jpg","order":"0","timestamp":"1374530546"}]}
The error occurs only on the iPad and iPhone. SyntaxError: JSON Parse Error: Unrecognized token '<' Any ideas on this one?