PHP側で
echo $_GET['callback'] . '(' . json_encode($object) . ');';
JS側で
$(function(){
$.getJSON('foo.php?callback=?',
{}, // No additional parameters sent
function (data) {
// data is now JSON object instantiated from retrieved info
alert(data*'key'*);
});
});
参考:
Mantis and Jessamine | Creating a JSONP Data Provider in PHP