PDA

View Full Version : not running the alert



olvap
30 Jan 2010, 4:51 PM
var BlueGrid = function(name){
var columns = new Array();
function addcolumn(){
columns =[{
name :'id',
header :'ID',
width :10
}];
}

Ext.Ajax.request( {
url : '/'+name+'s.json',
method : 'GET',
params: {
start: 0,
limit: 1
},
success : function(response) {
addcolumn();
alert('1 '+columns[0].name);

},
failure : function(){
alert('had trouble');
}
alert('2 '+columns[0].name);
});
}
Ext.onReady(function() {
var localidadgrid = new BlueGrid('localidad');
});

why i cant see the seccond alert????

30 Jan 2010, 7:54 PM
Why can't you post your code in CODE tags?

30 Jan 2010, 7:55 PM
The following block is invalid javascript:


Ext.Ajax.request( {
url : '/'+name+'s.json',
method : 'GET',
params: {
start: 0,
limit: 1
},
success : function(response) {
addcolumn();
alert('1 '+columns[0].name);

},
failure : function(){
alert('had trouble');
}
alert('2 '+columns[0].name);
});