Sencha touch 2 我可以直接加载模型,但不能从其他服务器加载
我收到错误信息 未捕获的TypeError:Object[Object Object]没有方法'writeRecords'ext all.js:18 解释为脚本但使用MIME类型text/html传输的资源:http://docs.sencha.com/touch/2-1/guides/data/examples/model_with_proxy/data/users/?_dc=1352957198178&page=1&start=0&limit=25&callback=Ext.data.JsonP.callback1". ext all.js:18 未捕获的语法错误:意外标记:Sencha touch 2 我可以直接加载模型,但不能从其他服务器加载,sencha-touch-2,Sencha Touch 2,我收到错误信息 未捕获的TypeError:Object[Object Object]没有方法'writeRecords'ext all.js:18 解释为脚本但使用MIME类型text/html传输的资源:http://docs.sencha.com/touch/2-1/guides/data/examples/model_with_proxy/data/users/?_dc=1352957198178&page=1&start=0&limit=25&callback=Ext.data.Jso
如果有人知道可以与我分享不熟悉框架,但当你试图从你的页面访问另一台服务器时,这似乎是XSS问题。是否有其他方法从其他服务器获取数据ExtJS和可能的Sencha Touch,以及有特殊方法从外部资源从自己的网站加载数据,检查他们的文档和论坛。你试过ajax请求而不是jsonp吗???尝试键入:“ajax”
**I am getting result for the below coding**
Ext.define('User', {
extend: 'Ext.data.Model',
fields: ['id', 'name', 'age'],
proxy: {
type: 'rest',
url : 'http://localhost:8085/sencha-touch-2.0.1.1-gpl/sencha-touch-2.0.1.1/docs/guides/data/examples/model_with_proxy/data/users/',
reader: {
type: 'json',
root: 'users'
}
}
});
**But when i try to get from other server i can't.I have tried this coding given below**
Ext.define('User', {
extend: 'Ext.data.Model',
fields: ['id', 'name', 'age'],
proxy: {
type: 'jsonp',
url : 'http://docs.sencha.com/touch/2-1/guides/data/examples/model_with_proxy/data/users/',
reader: {
type: 'json',
root: 'users'
}
}
});
var userStore;
Ext.require('Ext.data.Store');
Ext.onReady(function() {
// Uses the User Model's Proxy
userStore = Ext.create('Ext.data.Store', {
model: 'User',
autoLoad: true
});
// Gives us a reference to the User class
var User = Ext.ModelMgr.getModel('User');
var ed = Ext.create('User', {
name: 'Ed Spencer',
age : 25
});
// We can save Ed directly without having to add him to a Store first because we
// configured a RestProxy this will automatically send a POST request to the url data/users
ed.save({
success: function(ed) {
console.log("Saved Ed! His ID is "+ ed.getId());
}
});
// Load User 1 and do something with it (performs a GET request to /users/1)
User.load(1, {
success: function(user) {
console.log("Loaded user 1: " + user.get('name'));
}
});
});