I'm currently learning Ext Direct... i'm trying to make a login form. See code below:

code.js (loaded in index.php):
Ext.BLANK_IMAGE_URL = 'ext/resources/images/default/s.gif';

Ext.onReady(function () {
    var loginCallback = function (response, e) {
        if (e.status === true) {
            // response succesvol
            console.log('good login');
        else {
            // exception
            var error = e.message;

            Ext.Msg.alert('Login', error);

    // create Ext.Direct test window
    var loginWindow = new Ext.Window({
        title: 'Please login...',
        width: 300,
        height: 200,
        closable: false,
        layout: 'form',
        border: false,
        defaults: {
            xtype: 'textfield',
            width: 150
        items: [{
            // username textfield
            id: 'txtUsername',
            fieldLabel: 'Username'
            // password textfield
            id: 'txtPassword',
            fieldLabel: 'Password'
        buttons: [{
            text: 'Sign In',
            handler: function (button, event) {
                var username = Ext.getCmp('txtUsername').getValue();
                var password = Ext.getCmp('txtPassword').getValue();

                Test.Login.Send(username, password, loginCallback);



// eof
I use the php class 'Login' in Ext Direct:
PHP Code:

class Login
     * @remotable
public function Send($username$password)
// currently testing without database
if ($username == "nicobarten" && $password == "succes") {
// currently returning nothing
} else {
            throw new 
Exception("Unable to sign in. Invalid email or password.");

I have two questions now:

1) What should i do when the 'Send' method detects that the username and password is true? Should it return something like 'success' and do the javascript code do a relocation to another php file? Somebody has experience with this?

2) I'm currently testing without a database, because it's faster that way (for testing of course ). When i am going to use a database, where should i make the connection? In the 'Login.php' file? The file certainly needs it to run the query to test if the username and password are good. But i want in the whole application just one connection of course.

Also for side... the response of the Login.php Send method is now in json... i read somewhere you could also return javascript, does that mean that i can create a whole new extjs javascript window and return it?