codeiniterのRESTfulAPIから生成された(JSON)データを煎茶に供給しようとしています。Net.tutsCIAPIチュートリアルに基づいて RESTfulAPIを実行しました
エラーが発生しますUncaughtSyntaxError:Unexpected token:これが私のSenchaコードとCIコードです
CIコード
function user_get()
{
if(!$this->get('id'))
{
$this->response(NULL, 400);
}
$user = $this->user_model->get( $this->get('id') );
if($user)
{
$this->response($user, 200); // 200 being the HTTP response code
}
else
{
$this->response(NULL, 404);
}
}
生成されたJSON
{
name: "ALEX JOHN",
country: "USA",
city: "NY"
}
煎茶コード
Ext.application({
name: 'Sencha',
launch: function() {
Ext.create('Ext.DataView', {
fullscreen: true,
store: {
autoLoad: true,
fields: ['name', 'country','city'],
proxy: {
type: 'jsonp',
url: 'http://localhost/rest_api/index.php/users/user/id/2',
callbackKey: 'callback',
callback: function(result) {
console.log(result) ;
},
reader: {
type: 'json'
}
}
},
itemConfig: {
tpl: '<p>{city}</p>'
}
});
}
});
その地域がどこから来たのかわかりません。それは私のJSONデータ形式からですか?煎茶はそれをどのように消費していますか?親切に誰かが助けてくれます。ありがとうございました