I have just upgraded to cakephp 2.4.1 as it now supports JsonP. I was previously getting an a missing callback error in my ajax cross domain code. However the documentation does not mention any additional steps need to implement this so I would have thought that it should wold but i get the same error as before.
Do I need an extra piece of code to send the callbck back?
My Controller
public function api($mem_id = null) {
$options = array(
'fields' => array('Member.total_points'),
'conditions' => array('Member.member_no' => $mem_id),
'recursive' => -1
);
$members = $this->Member->find('first', $options);
$this->set(array(
'member' => $members,
'_serialize' => array('member')
));
}
}
ajax code
$('document').ready(function() {
$.ajax({
url: 'http://mydomain.com/loyalty/members/api/5749.json',
dataType: 'jsonp',
success: function(response) {
console.log(resonse);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
}
});
});