1. #1
    Sencha User
    Join Date
    Apr 2014
    Posts
    1
    Vote Rating
    0
    max2014 is on a distinguished road

      0  

    Default Unanswered: Problems with JsonP

    Unanswered: Problems with JsonP


    Hello,

    I'm new to Sencha Architect. I try to read json data from a web server and want to popuplate a list with that.
    So I created a JsonP store, because I read that this one should be used if the application doesn't run on the same domain. Next I created a Model and linked it to the store. Finally I updated the list template.
    If I use dummy data, it works fine. But the server request (which delivers the same data) doesn't work. The following message appears: "Unable to load data using the supplied configuration."

    Here's the generated Code:

    Store:
    Code:
    Ext.define('GastroApp.store.TablesStore', {
        extend: 'Ext.data.Store',
    
        requires: [
            'GastroApp.model.TableModel',
            'Ext.data.proxy.JsonP',
            'Ext.data.reader.Json'
        ],
    
        config: {
            autoLoad: true,
            model: 'GastroApp.model.TableModel',
            storeId: 'TablesStore',
            proxy: {
                type: 'jsonp',
                url: 'http://kunde.sg-multimedia.de/gastro/json.php',
                reader: {
                    type: 'json'
                }
            }
        }
    });

    Model:
    Code:
    Ext.define('GastroApp.model.TableModel', {
        extend: 'Ext.data.Model',
    
        requires: [
            'Ext.data.Field'
        ],
    
        config: {
            fields: [
                {
                    name: 'uid',
                    type: 'int'
                },
                {
                    name: 'name',
                    type: 'string'
                },
                {
                    name: 'nummer',
                    type: 'string'
                }
            ]
        }
    });
    What am I doing wrong?

  2. #2
    Sencha Premium Member
    Join Date
    Nov 2007
    Location
    Moore, Oklahoma
    Posts
    485
    Vote Rating
    15
    Answers
    9
    Mthor will become famous soon enough

      0  

    Default


    to me when I go to that url, I do not get valid JSON.

    also might need to add a root to the proxy.

    http://jsonformatter.curiousconcept.com/

Thread Participants: 1