Link to home
Start Free TrialLog in
Avatar of PixelMuse
PixelMuse

asked on

ExtJS, issues with trying to create a datastore

I have the following code and it's always failing. What is the best way to provide a detailed error message so I can see what the issue is?
function createDataStore(){

    var url = GLOBAL_URI + '/Users';
    myNamespace.UserDataStore = new Ext.data.JsonStore({
        url: url,
        root: 'Subscriptions',
        id: 'userId',
        fields: [{
            name: 'userId'
        }, {
            name: 'userName'
        }]
    });
    
    var objUser = {
        "userId": "",
        "Id": ""
    };
    
    
    myNamespace.UserDataStore.proxy.conn.jsonData = objUser;
    myNamespace.UserDataStore.proxy.conn.method = 'POST';
    
    myNamespace.UserDataStore.load({
        callback: function(records, o, s){
            if (!s) 
                Ext.MessageBox.show({
                    title: 'Error',
                    msg: 'POST method failed',
                    buttons: Ext.MessageBox.OK,
                    icon: Ext.MessageBox.ERROR
                });
            else 
                Ext.getCmp('ddlUserId').setValue(userId);
        }
    });
}

Open in new window

Avatar of PixelMuse
PixelMuse

ASKER

I've debugged it using Fiddler and it is showing me a "HTTP/1.1 400 Bad Request" error.

Any thoughts on ways to solve that?
ASKER CERTIFIED SOLUTION
Avatar of youssefomar
youssefomar
Flag of Libya image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial