PDA

View Full Version : loading html and javascript content with ajax



n00b
16 Oct 2009, 1:10 AM
Hi,

Here is my problem :

Using the desktop widget, I'm trying to load a remote page from the server inside a window. Everything is OK, everything is loaded.

But now, i want that my form which is on this page(window) doesn't redirect the user on a new page after submition, that's why im using a <input type="button" />

Then, I try to bind this button to the Ext code for making Ajax queries based on events, but it seems the javascript which is gotten via Ajax is NOT executed. This binding is supposed to load in the same time as the html content of my form...

I thought that i could already include this javascript binding code on the desktop js file itself, but, since my form is remotely loaded, ext tells me that on load, my button doesn't exist yet, which is true...

So, is it possible to make the remotely gotten javascript code to be executed ?
If yes, then where did i up ? xD

Thanks

aconran
16 Oct 2009, 4:01 AM
Yes, you can embed inline JavaScript in your html and have it executed.

If you are using the autoLoad (http://www.extjs.com/deploy/dev/docs/?class=Ext.Panel&member=autoLoad) configuration of Ext.Panel you can specify scripts: true

ie:


autoLoad: {
url: 'myhtmlandjs.html,
scripts: true
}

n00b
16 Oct 2009, 10:58 AM
Epic, that works great ! Thanks a lot !

I just discovered ExtJS today, but I already love it, this is an outstanding piece of work.

Another question : is it possible to make JQuery to work with ExtJS without conflicts ?
'cause if it's possible, it would save me a substancial amount of time of rewriting apps for ExtJS :D

aw1zard2
16 Oct 2009, 11:02 AM
Look in your ext-3.0.0 folder/directory for adapters. :)

n00b
16 Oct 2009, 11:13 AM
Thanks again ! Made it working, this is just wonderful :D

All my context menus and drag & drop made with JQuery work inside a ExtJS window....in just a few minutes !! :D