PDA

View Full Version : [SOLVED]Redirect to another page after success Ext.Ajax.request [/SOLVED]



jimmyful
6 Jul 2010, 7:20 AM
Hi. I need redirect to another page after success in Ext.Ajax.request, can I do that?



Ext.Ajax.request({
url: 'prueba.ashx',
success: function()
{ Ext.Msg.alert('Mensaje', 'Operacion realizada con éxito. revisar el resumen.');
var redirect='http://localhost/PruebaExt/Default.aspx';
Window.location=redirect; // dont do anything. --problem.
},
failure: function(){Ext.Msg.alert('Mensaje', 'Fallo');
});


++ plus: I need wait for ok button to redirect to another page. Help me please.

regards.

jimmyful
6 Jul 2010, 9:25 AM
I found the solution. this code go to 'prueba.ashx' again without params, but works.


Ext.Ajax.request({
url: 'prueba.ashx',
success: function(){
Ext.Msg.show({
title: 'Salir',
buttons: Ext.MessageBox.OK,
msg: 'Proceso completado con exito. Revise el resumen.',
fn: function(btn){
if (btn == 'ok'){
Ext.Ajax.request({
url: 'prueba.ashx', //again
callback: function(){
window.location = 'Default.aspx';
}
});
}
}
}); //Ext.Msg.show
} //SUCCESS
}); //Ext.Ajax.request