PDA

View Full Version : Getting data back in XML and updating fields using AJAX



Akansha
5 Jun 2007, 10:18 PM
Hi,
i am new to EXTJS. I want to make an application which sends a param to the server and retrieve the data back from it in XML format asynchronously. My problem is that if i am using update method..it is replacing the element with the received data. I want to update some other fields. Jus tell me that hw to get back data and put it in other fields.

Animal
5 Jun 2007, 10:57 PM
See docs: http://extjs.com/deploy/ext-1.1-beta1/docs/

http://extjs.com/deploy/ext-1.1-beta1/docs/output/Ext.Ajax.html#request

(The Ajax object is in 1.1 - you'll have to download that version)

Akansha
6 Jun 2007, 1:22 AM
Is there any example using Ext.AJAX class

Animal
6 Jun 2007, 1:49 AM
How difficult is the doc to read?



Ext.Ajax.request({
url:"/foo.do",
callback: myObj.myfunction,
scope:myObj
});

Akansha
6 Jun 2007, 2:34 AM
i did the same thing...
Error is coming that this.fireEvent is not a function.

Animal
6 Jun 2007, 2:35 AM
That's because the thing you are sending as a callback is not a function.

At a guess, you'er sending the RESULT of a function call through to request.

jsakalos
6 Jun 2007, 2:36 AM
i did the same thing...
Error is coming that this.fireEvent is not a function.

In which scope do you call the request?

Akansha
6 Jun 2007, 2:37 AM
Thats working fine nw...but i have one major problem that the response is coming as [object Object]..hw to read it as XML..

Akansha
6 Jun 2007, 2:40 AM
In which scope do you call the request?

i am not using scope attribute..

Animal
6 Jun 2007, 2:42 AM
You should read around a subject before you launch into it. Other things than XML can be retrieved.

You are accessing this object:

http://www.w3.org/TR/XMLHttpRequest/

Akansha
6 Jun 2007, 2:45 AM
i got it...thanx for ur help and time..

couyulecaribou
7 Jan 2008, 2:12 PM
Hi,

I'm quite new to ExtJs too and I've got the same error, but may be for some other reason. I want to display the details of the person when someone double click on the row of th grid. I've got a grid panel with this event listener :

grid.addListener('rowdblclick', function(grid, rowIndex, e){
person1.showDetails(grid.store.data.items[rowIndex].data.id);
});

and the method showdetails is here:

Person.prototype.showDetails = function(idPerson) {

var request1 = new Ext.Ajax.request({
url: '/admin/edit_ressource/' + idPerson,
method: 'GET',
success: function ( result, request ) {
Ext.MessageBox.alert('Success', 'Data return from the server: '+ result.responseText);
},
failure: function ( result, request) {
Ext.MessageBox.alert('Failed', result.responseText);
}
});
}

And I've got this error, which I do not understand :

this.fireEvent is not a function
[Break on this error] if(this.fireEvent("beforerequest", this, o) !== false){

If someone could help me... thanks