M
MPennig
Here's my situation. I have a function defined in my document's <head>
section which adds a <script> tag to a specified <div> tag. The added
<script> has a src="" attribute pointing to a PHP file, which
dynamically returns JavaScript. In Safari, the src file isn't
downloaded. Neither is any code contained within the new script tag
[such as alert()]. In IE(6) and Firefox, this works as expected.
Here's my code. I hope it will better illustrate what I'm trying to
accomplish:
-------------------
[usage]
<div id="123456">
<a href="#" onclick="add_detail('123456')">Click me</a>
</div>
[in <head>]
function add_detail(divID) {
detail = document.getElementById(divID);
new_script = document.createElement('script');
new_script.setAttribute('src', 'get_details.php?id='+divID);
document.getElementById(occID).appendChild(new_script);
}
[get_details.php]
(returns dynamically generated javascript code for inserting text
through the DOM... is dependant on the 'id' variable in query string)
-------------------
My goal with this code is to selectively, dynamically receive text and
add it to the document tree without leaving or refreshing the page. I
chose not to load all of the text because it uses web services and
would be a heavy load, as each page has about 50-100 of the above
'Click me' links.
Either a solution to make this work in Safari, or a new method would
be greatly appreciated. Thanks in advance!
section which adds a <script> tag to a specified <div> tag. The added
<script> has a src="" attribute pointing to a PHP file, which
dynamically returns JavaScript. In Safari, the src file isn't
downloaded. Neither is any code contained within the new script tag
[such as alert()]. In IE(6) and Firefox, this works as expected.
Here's my code. I hope it will better illustrate what I'm trying to
accomplish:
-------------------
[usage]
<div id="123456">
<a href="#" onclick="add_detail('123456')">Click me</a>
</div>
[in <head>]
function add_detail(divID) {
detail = document.getElementById(divID);
new_script = document.createElement('script');
new_script.setAttribute('src', 'get_details.php?id='+divID);
document.getElementById(occID).appendChild(new_script);
}
[get_details.php]
(returns dynamically generated javascript code for inserting text
through the DOM... is dependant on the 'id' variable in query string)
-------------------
My goal with this code is to selectively, dynamically receive text and
add it to the document tree without leaving or refreshing the page. I
chose not to load all of the text because it uses web services and
would be a heavy load, as each page has about 50-100 of the above
'Click me' links.
Either a solution to make this work in Safari, or a new method would
be greatly appreciated. Thanks in advance!