View Full Version : Ajax connection problem

14 May 2010, 2:59 AM
Hello, I am making an Ajax request from an extjs client to a servlet to populate a grid with an xml using a POST method.
The xml contain a list of books, with title and author.
When I test everything I notice that the grid in not correctly populated(2 books instead of 6), when I refresh my page, I notice that now there are more books in the grid(sometimes 5 or 6).
Every time from this moment when I refresh the page I can see 5 or 6 books in the grid.
I don't really know why I am not able to populate the grid with everything from the first moment.
Is it a time problem?
I don't think this is a servlet problem, but for more clearness:
In the servlet I search in a folder, where there are some xml files, and with DOM I catch the title and the author from that files; so I create an xml with all titles and authors.
If someone want I can also post the servlet's code.

This is my code

params : {
foo: 'bar',
method: 'POST',
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);

var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({

// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'libro',
id: 'idlibro',
//totalRecords: '@total'
}, [
{name: 'titolo', mapping: 'titolo'},
{name: 'autore'},