简体   繁体   中英

Proxy Api error on Ext JS 4

I'm just started playing Ext JS 4 and following to create MVC application using Ext JS 4. The article URL at http://www.sencha.com/learn/the-mvc-application-architecture/ . But when i'm running the application on Chrome it's showed error. Chrome says: "You are using a ServerProxy but have not supplied it with a url.", but the application run well on Firefox and Safari. Can anyone tell me how to fixed the bug?

Ext.define('AM.store.Users', {
   extend: 'Ext.data.Store',
   model: 'AM.model.User',
   autoLoad: true,
   autoSync: true,
   proxy: {
        type: 'ajax',
        api: {
            read: 'data/users.json',
            update: 'data/updateUsers.json'
        },
        //url: 'data/users.json',
        reader: {
            type: 'json',
            root: 'users',
            successProperty: 'success'
        }
    }
});

Thanks.

@andriansandi

但是遇到同样的问题,但是添加了create:“ data / updateUsers.json”正在解决该问题,不确定是否正确

Are you running this from a web server or just as a file? If you're loading your html from a file your problem might be caused by a security exception.

If it's happening when you make a new model try adding the create url to your config like so:

api: {
        read: 'data/users.json',
        update: 'data/updateUsers.json',
        create: 'data/updateUsers.json'
     }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM