-
loaded page can not run javascript :-(
Hi,
i have a simple ajax script which load pages into divs. this works perfectly.
my problem is that loaded pages should run some javascript scripts and once loaded into divs, they do not.
where could be the problem ?
here is an example of loaded page:
Code:
<html>
<body>
<script>
alert("test");
Remove_js_css_file("modules/tool/tool.css", "css");
</script>
<link rel='stylesheet' type='text/css' href='modules/tool/tool.css' media='screen' />
<div class='local_breadcrumb'>
<div class='breadcrumb_txt'>test of local tool.css which does not work !</div>
</div>
<div class='helo'>test
</div>
</body>
</html>
-
Welcome to DevX 
Does the javascript cause errors or just not do anything at all?
-
in fact, it does not do anything at all.
for example, i just placed a simple alert("test"); and nothing happened.
neither error nor message.
-
-
How do you add the AJAX obtained content into your page? Using innerHTML or DOM manipulation? I believe it should work if you use innerHTML. To load an external script (.js file), you can also dynamically create a "script" element (DOM; createElement), add the src attribute and insert into the document tree somewhere.
Code:
function myajaxcallback()
{
// Do whatever
var scriptsource = "/srcipts/source.js";
var scel = document.createElement("script");
scel.addAttribute("src", scriptsource);
document.body.addendChild(scel);
}
-
Hi,
I too have same problem, server returns response in text format. The response text contains the javascript, entire response code has been added to div element. The javascript with in the response text is not at all triggerd/called.
Any suggestion are welcome.
Thanks,
-
Re :
Hi ,
i also was having such kind of problem, and what i did was i didnt include the javascript in the response text(results.jsp). Instead , i placed the javascript within <head> element of the page (index.jsp) , in which the response text will be printed. That method worked fine.
In that way i could be able to have my javascript as a seperate file and import it to the index.jsp.
Hope this will be useful.. , n by the way im also pretty much new to AJAX development
i too have an unsolved question regarding CSS support in the updated content, that is , the repsonse text.. if anybody of u knws that pls help me to sort it out..
Regards
Sk
Similar Threads
-
By iKhristosi in forum ASP.NET
Replies: 1
Last Post: 08-12-2008, 12:47 PM
-
By Jason Salas in forum ASP.NET
Replies: 2
Last Post: 04-21-2003, 07:12 AM
-
By max caber in forum .NET
Replies: 13
Last Post: 10-03-2001, 04:05 PM
-
By tomer dror in forum XML
Replies: 0
Last Post: 02-14-2001, 08:32 AM
-
By Jason Whitehead in forum Web
Replies: 2
Last Post: 12-14-2000, 11:46 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|