Solved

ExtJS, issues with trying to create a datastore

Posted on 2010-11-08
2
675 Views
Last Modified: 2012-05-10
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

0
Comment
Question by:PixelMuse
2 Comments
 

Author Comment

by:PixelMuse
Comment Utility
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?
0
 
LVL 6

Accepted Solution

by:
youssefomar earned 500 total points
Comment Utility
I think the error is caused by not specifying the target server side script where the data is supposed to be POSTed

try to add something like this:

myNamespace.UserDataStore.proxy.conn.url = 'file_name.php'

before or after :

    myNamespace.UserDataStore.proxy.conn.jsonData = objUser;
    myNamespace.UserDataStore.proxy.conn.method = 'POST';

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now