1. datastore 方式
Ext.define('User', {
extend: 'Ext.data.Model',
fields: ['id', 'name', 'email']
});
var s1 = Ext.create('Ext.data.Store', {
model: 'User',
autoload:false,
proxy: {
type : 'rest',
url : 'http://127.0.0.1:8080/mypath/rest/resources/my'
}
});
2.
a.
Ext.Ajax.cors=true;
Ext.Ajax.useDefaultXhrHeader=false;
Ext.Ajax.request( {
url : 'http://127.0.0.1:8080/mypath/rest/resources/my',
method:'get',
success:function(response) {
console.info(response);
}
});
b.
Ext.Ajax.request( {
useDefaultXhrHeader:false,
cors:true,
url : 'http://127.0.0.1:8080/mypath/rest/resources/my',
method:'get',
success:function(response) {
console.info(response);
}
});