Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Sencha Touch通过JsonP加载xml数据_Javascript_Xml_Sencha Touch_Jsonp_Sencha Touch 2 - Fatal编程技术网

Javascript Sencha Touch通过JsonP加载xml数据

Javascript Sencha Touch通过JsonP加载xml数据,javascript,xml,sencha-touch,jsonp,sencha-touch-2,Javascript,Xml,Sencha Touch,Jsonp,Sencha Touch 2,我正在尝试通过senchatouch中的JsonP加载xml数据,我对senchatouch非常陌生 以下是我的观点代码 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

我正在尝试通过senchatouch中的JsonP加载xml数据,我对senchatouch非常陌生

以下是我的观点代码

 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'
                }
            }
        }

    },
}});
服务器端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;
}

?>

当我尝试启动它时,出现以下错误:

Uncaught SyntaxError: Unexpected token <
未捕获的语法错误:意外标记<
我能做些什么才能让它工作


谢谢你帮助我

这是我的错。我试图通过jsonp加载xml数据,但这是不可能的。