I have an javascript that I place into a page using the code below. What the code does is place an object/embed code into a webpage. Simple javascript loader to a NicoVideo movie
<script type="text/javascript" src="http://ext.nicovideo.jp/thumb_watch/sm13154955?w=640&h=395"></script>
This works great in a webpage. But what if I want to load this javascript into a page using AJAX? This no longer works for the obvious reasons, you would need to eval the script in order to get it to run. However, I have no idea how to do this. I am using jQuery on my page; so keep that in mind. I have tried the following code, but it doesn't seem to work through AJAX, or even in a normal page load environment.
<script>$.getScript("http://ext.nicovideo.jp/thumb_watch/sm13154955?w=640&h=395");</script>
Any ideas on how I would get this to work?
' or some other tag. The way that javascript is crafted, it will be executed inline at page load. As such, when you load via AJAX, it may not necessarily execute at the time it is requested, rather after the page is rendered. So essentially, the elements for the video display will be written into the document say after the 'html' close element. Essentially, you want to replace the contents of an element with this player using jQuery to do the repl.
– Dave G Jan 07 '11 at 15:15