Translate

lunes, 19 de mayo de 2014

Ext.JS and Visual Studio: HTTP Error 404 file not found when loading json file

I have the following store defined, loading data from a json file:

Ext.define('Uge.store.Articles', {
    extend: 'Ext.data.Store',
    model: 'Uge.model.Article',
    proxy: {
        type: 'ajax',
        url: 'data/articles.json',
        reader: {
            type: 'json',
            root: 'articles',
            successProperty: 'success'
        }
    },
    autoLoad: true
});

Data to load is inside the file data/articles.json, but when trying to load data we get an error pointing that file could not be found.
 
To avoid this error you need to set your project to accept json file types. You can do this setting the following configuration into web.config file: