PDA

View Full Version : user managment via ajax



Stephan123
19 Aug 2009, 8:05 AM
Hello !

I have an login window.
In this window i send the user and the password to an php script.
The php script send the buttons , splitbuttons ...
back to the Ext and insert this elements in a toolbar.

My problem is, i need an example script how i can handle
an 'ajax - response - object' in ExtJS.

My first draft script


Ext.Ajax.request({
url: 'login/login.php',
scripts: true,
params: {
aktion: 'login',
benutzer: Ext.fly('benutzer').getValue(),
passwort: Ext.fly('passwort').getValue()
},
success: function(response){
antwort = Ext.util.JSON.decode(response.responseText);

if(antwort.success == true){

// schließt 'login'
login.close();

// fügt Button hinzu
var tool = Ext.getCmp('navigation');


/***

insert the object in the toolbar

***/


// erweitert Toolbar
tool.doLayout();

}
}
});

Greetings

Stephan

avsomeren
19 Aug 2009, 12:46 PM
Why not create all the controls on the toolbar within your javascript, and remove/disable them based on simple json values in your response?

Animal
19 Aug 2009, 12:49 PM
add or insert

The methods are right there in the API doc