Re: ajax & php & javascript



Ivan P said the following on 5/25/2006 5:55 AM:
Hello!

<snip>

function processStateChange(){

<snip>

contentDiv.innerHTML = response;

<snip>

file.php looks like this:

<span id="countdowncontainer">
write something down
<script type="text/javascript">
document.write("1")
</script>
</span>

<snip>

The problem is that "write something down" displays on the Internet
Explorer, but number 1 doesn't.

It won't in most other browsers as well.

If we call just file.php - it works then - it displays both.

Yes.

Why is javascript not executing from ajax called procedure?

It has nothing to do with it being an "ajax called procedure". It has to do with inserting the script via innerHTML and the script blocks don't get processed when doing that.

If you want to execute script blocks, then you will have to use a different method of inserting it in the page to get the browser - any browser - to execute the script.

The only browser I recall that executed script's inserted via innerHTML was NS6.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
.



Relevant Pages