我有一个简单的模型:
Ext.define('MovieModel', {
extend : 'Ext.data.Model',
fields : [ {
name : 'Title',
mapping : '@title',
type : 'string'
} ],
proxy : {
type : 'ajax',
url : 'http://www.imdbapi.com/?r=xml&plot=full',
method : 'GET',
reader : {
type : 'xml',
record : 'movie'
}
}
});但此代码不支持跨域策略。我该怎么解决它呢?
发布于 2011-11-02 23:25:42
首先去掉r=xml参数。使用jsonp one而不是ajax代理:
proxy : {
type : 'jsonp',
url : 'http://www.imdbapi.com/?plot=full',
// jsonp uses its special method for retrieving data. So no need for the following row
//method : 'GET',
reader : {
type : 'json',
// the record param is used when data is nested construction
// which is not true in your case
//record : 'movie'
}
}这是demo。
https://stackoverflow.com/questions/7977730
复制相似问题