?
Solved

ExtJS, issues with trying to create a datastore

Posted on 2010-11-08
2
Medium Priority
?
704 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:PixelMuse
ID: 34087961
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 2000 total points
ID: 34092109
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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…
Suggested Courses

762 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