0
                **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'));
                        }
                    });
                    });

Uncaught TypeError: Object [object Object] has no method 'writeRecords' ext-all.js:18 Resourceinterpreted as Script but transfer with MIME type 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 Uncaught SyntaxError: 予期しないトークン:

誰かが私と共有できることを知っているなら

4

0 に答える 0