I am trying to load xml data via JsonP in sencha touch and I'm very new to sencha touch.
Here is the code of my view
Ext.define("test.view.list", {
extend : 'Ext.navigation.View',
requires:[
'Ext.dataview.List',
'Ext.data.proxy.JsonP',
'Ext.data.reader.Xml',
'Ext.data.Store'
],
config : {
items : {
xtype : 'list',
itemTpl : '{title}',
title : 'All_data',
store: {
autoLoad: true,
fields: ['title'],
proxy: {
type: 'jsonp',
url: 'http://www.mydomain.com/data.php',
callbackKey: 'callback',
callback: function(data){
Alert('123');
},
reader: {
type: 'xml',
rootProperty: 'items',
record: 'item'
}
}
}
},
}});
The server-side php:
<?php
$callback = $_REQUEST['callback'];
$data =
'<items><item><title>Hello</title></item></items>';
if ($callback) {
header('Content-Type: text/javascript');
echo $callback . '(' . $data . ');';
} else {
header('Content-Type: text/xml');
echo $data;
}
?>
When i try to start it, i get the following error:
Uncaught SyntaxError: Unexpected token <
What can I do, in oder to make it work?
Thank you for helping me out!