PDA

View Full Version : How to load request result into the variable?



softm
19 Jan 2011, 5:51 PM
Have problem with this code:


Ext.onReady(function(){
Ext.get( "btn_submit" ).on( "click" , function(){
var msg = Ext.get( "msg_login" );

msg.load({
url: "answer.php?act=login_auth",
params: 'user=' + Ext.get( "user" ).dom.value + '&pass=' + Ext.get( "password" ).dom.value,
text: 'Processing load...'
});

msg.show();

HOW TO FIND this text???

if ( txt_ == "login ok" )
{
location.href = "./admin.php?l";
}

});
});



i.e. i load an span element with some text from external URL.
How can i get later this text, i.e. login okj, or login bad, to analise it & redirect?

i try Ext.get( "msg_login" ) .dom.value - but it have not newly loaded string, but 'Processing load...'!!!

Pls help me.

20 Jan 2011, 6:49 AM
you'll need to setup a callback in the load. the load is asynchronous, thus a callback is essential.

softm
20 Jan 2011, 11:20 AM
Thank your!
I already make thius in other way, - simply dubb the call with ajax call.
And in function "on success" - make needed redirection if() ... .