views:

70

answers:

2

I'm going through some beginners tutorials on ExtJS and when I try to load a .html file with some HTML code it doesn't work

here's the test.html with the ExtJS code

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title id='title'>HTML Page setup Tutorial</title>

    <!-- ** CSS ** -->
    <!-- base library -->
    <link rel="stylesheet" type="text/css" href="../ext-3.2.1/resources/css/ext-all.css" />

    <!-- overrides to base library -->


    <!-- ** Javascript ** -->
    <!-- ExtJS library: base/adapter -->
    <script type="text/javascript" src="../ext-3.2.1/adapter/ext/ext-base.js"></script>
    <!-- ExtJS library: all widgets -->
    <script type="text/javascript" src="../ext-3.2.1/ext-all-debug.js"></script>


    <!-- overrides to library -->

    <!-- extensions -->

    <!-- page specific -->

    <script type="text/javascript">
    // Path to the blank image should point to a valid location on your server
    Ext.BLANK_IMAGE_URL = '../ext-3.2.1/resources/images/default/s.gif';

    Ext.onReady(function(){
        Ext.get('div1').load({
            url : 'htmlFragment.html',
            scripts : true
        });
    });

    </script>

</head>
<body>
<div id='div1'></div>
</body>
</html>

and the htmlFragment.html is just as it says, a fragment of HTML code

<div>Hello there! This is an HTML fragment.</div>

both the file with the ExtJS code and the htmlFragment.html are in the same folder and I really see no reason for this not to work but it doesn't :(

all the other ExtJS examples I tried, DOM manipulation and other basic stuff worked just fine

I'm trying this on a Windows machine, and it doesn't work in any browser(FF, Opera, IE, Chrome)

A: 

Do u have firebug enabled on your machine? If so, do you get any exceptions on the firebug console? It could be that the ext library path is incorrect. Also check firebug to see if your ext library files are being loaded.

ajayr
A: 

Have you set your example in a Web Server?

Even though many examples work just directly open its local file on your browser (i.e. file:///C:/directory/example.html) many others require an actual web server to run properly (i.e.: http://localhost/path/example.html).

And I think local files won't work in this example as it has to performs an AJAX call to get the htmlFragment.html file.

Are you using any of the following (or any other) web server?

  • Apache HTTP Server
  • lighttpd
  • Apache Tomcat
  • Internet Information Server
  • Visual Studio Built-in Web Server
Protron
thanks man, this worked :)
kalkulus