1

this website I'm trying to setup doesn't seem to be loading the js. I have installed json and php-pear and restarted apache and whatnot. when I go to the page all I see is the background and the banner.

<html>
<head>
<link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" />
<script type="text/javascript" src="../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../ext-all.js"></script>
<style type="text/css">
body
{
font-family: Arial, Verdana, sans-serif;
background-image: url(graphics/background_gradient.png);
background-repeat: repeat-x;
background-color: #374d5b;
margin: 0;
padding: 0 0 20px 0;
font-size: 13px;
color: #333;
text-align: center;
}
.root
{
width: 410px;
margin: 0 auto;
text-align: left;
background-color: #e6e6e6;
position: relative;
}

#header
{
background: #0e1d2f url(graphics/banner.png) no-repeat left;
height: 90px;
}
</style> 
</head>
<body>
    <div class="root">
        <div id="header"></div>
    </div>
    <script type="text/javascript" src="login.js"></script> 
</body>
</html>

I am running CentOS 5

Login.js:

Ext.onReady(function(){
Ext.QuickTips.init(); 
var login = new Ext.FormPanel({ 
    labelWidth:80,
    url:'login.php', 
    frame:true, 
    title:'Please Login', 
    defaultType:'textfield',
monitorValid:true,
    items:[{ 
            fieldLabel:'Username', 
            name:'loginUsername', 
            allowBlank:false 
        },{ 
            fieldLabel:'Password', 
            name:'loginPassword', 
            inputType:'password', 
            allowBlank:false 
        }],

    buttons:[{ 
            text:'Login',
            formBind: true,  
            handler:function(){ 
                login.getForm().submit({ 
                    method:'POST', 
                    waitTitle:'Connecting', 
                    waitMsg:'Sending data...',
                    success:function(){ 
                        Ext.Msg.alert('Status', 'Login Successful!', function(btn, text){
                            if (btn == 'ok'){
                                var redirect = './panel.php'; 
                                window.location = redirect;
                            }
                       });
                    },
                    failure:function(form, action){ 
                        if(action.failureType == 'server'){ 
                            obj = Ext.util.JSON.decode(action.response.responseText); 
                            Ext.Msg.alert('Login Failed!', obj.errors.reason); 
                        }else{ 
                            Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText); 
                        } 
                        login.getForm().reset(); 
                    } 
                }); 
            } 
        }] 
});

var win = new Ext.Window({
    layout:'fit',
    width:300,
    height:150,
    closable: false,
    resizable: false,
    plain: true,
    border: false,
    items: [login]
});
win.show();
});
4
  • You shouldn't have a url() surrounding login.js in your last script tag's src attribute, what is firebug giving you ? Commented May 23, 2012 at 15:31
  • remove url() and still no dice, what is firebug? sorry, im pretty new to this Commented May 23, 2012 at 15:38
  • firebug is a debug tool for firefox (addon, see addons.mozilla.org/fr/firefox/addon/firebug ), it allows you to see how your page is build, applied css and above all executed requests, with it you will be able to see if your scripts are loaded, and if so you will have a debug console showing you script errors. Commented May 23, 2012 at 15:44
  • It sounds like your Ext.js files aren't loading. Are those paths correct? You can try opening Chrome's Network tab or Firefox's console when you load the page, and I'm guessing you'll see 404s on those requests. Commented May 24, 2012 at 0:37

2 Answers 2

2

The url() syntax is specific to CSS. For loading JS in HTML, it's the same as an <img> tag.

<script type="text/javascript" src="login.js"></script>

This would assume login.js is located in the same directory as your page.

Sign up to request clarification or add additional context in comments.

Comments

-1

Turns out I hadn't uploaded the proper file (ext-base.js) Uploaded that and a few more dependencies and it worked perfectly. thanks for all the help though guys xD

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.