PDA

View Full Version : element.load params problem



rsuplido
5 Apr 2007, 5:57 AM
I was following the intro tutorial (http://extjs.com/tutorial/introduction-ext) and when trying out the ajax part, I'm getting some problems with the params parameter of element.load.

Here's the original script:


Ext.onReady(function(){
Ext.get('okButton').on('click', function(){
var msg = Ext.get("msg");
msg.load({
url: "http://www.somedomain.com/test.php",
params: "name=" + Ext.get('name').dom.value,
text: "Updating..."
});
msg.show();
});
});


For some reason, I can't get it to work. This works however:


Ext.onReady(function(){
Ext.get('okButton').on('click', function(){
var msg = Ext.get("msg");
msg.load({
url: "http://www.somedomain.com/test.php?name=" + Ext.get('name').dom.value,
text: "Updating..."
});
msg.show();
});
});


Any info why?

TIA.

tab
5 Apr 2007, 6:53 AM
I had a similar problem, when I looked at the HTTP headers using FireBug or LiveHttpHeaders, there was some thing about whether I specified the url with a trailing "/" or not. When I looked at the headers I was getting http://foo/blah/default/param instead of blah/param.

Animal
5 Apr 2007, 11:51 PM
params is an object, not a string:



{"name": Ext.get('name').dom.value}