Ajax requested page doesn't run javascript

S

sgmaat

I have create a AJAX webpage where if you press a link content is
loaded into a div. NOw when this content is loaded no javascript is
processed (i.e <Script>alert(..);</script>), but if the javascript is
in <a onclick="..."> it will work.
What i would like to know is:
- Is this normal
- What do i need to change so that javascript does get processed?

Thanks in advance,
Stephan Maat
 
P

petermichaux

Hi Stephan,

I have create a AJAX webpage where if you press a link content is
loaded into a div. NOw when this content is loaded no javascript is
processed (i.e <Script>alert(..);</script>), but if the javascript is
in <a onclick="..."> it will work.
What i would like to know is:
- Is this normal
- What do i need to change so that javascript does get processed?

Yes it seems to be normal that the javascript in script tags isn't
processed. The javascript in the onclick gets processed when the click
occurs, or so it seems.

Yesterday I went through this very same thing and asked about it here.
The thread was called "run JavaScript that is part of AJAX response".
Lasse gave me some great advice about how to deal with this in my
situation.

http://groups.google.com/group/comp...845a4/a89890b18d005e9e?hl=en#a89890b18d005e9e

It is interesting to note that the Prototype.js Ajax.Updater() function
seems to automatically run the javascript when it inserts the AJAX
response. This is why I've temporarily reverted to using the
Prototype.js library for AJAX until I can try writing some higher level
functions for the Yahoo! UI connection library.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top