KUKayaker Posted December 3, 2008 Share Posted December 3, 2008 I need assistance with loading javascript on a page loaded by an ajax function. The function works correctly for other pages but on this particular page I'm loading a flash mp3 player. When I open that page directory I see the player but when I load it through ajax I just get the original div that should be replaced. In further testing I noticed that no inline javascript seems to load so for example if I load a php page with the following code: <script type="text/javascript"> alert("test"); </script> It doesn't trigger. The code on the page I'm trying to load is below: <script type="text/javascript" src="Player/swfobject.js"></script> <div id="flashPlayer"> This text will be replaced by the flash music player. </div> <script type="text/javascript"> alert("test"); var so = new SWFObject("Player/playerMultipleList.swf", "mymovie", "295", "200", "7", "#FFFFFF"); so.addVariable("autoPlay","no") so.addVariable("playlistPath","MP3Playlist.php") so.write("flashPlayer"); </script> I assume this is a really common problem I just wasn't able to find what I was looking for in searching. Thanks for any help in advance. Quote Link to comment Share on other sites More sharing options...
corbin Posted December 4, 2008 Share Posted December 4, 2008 It doesn't load because AJAX doesn't parse JS. It's job is to retrieve remote data, not retrieve and process remote data. You can either eval() it, or you can use some other method. (A framework with parsing capabilities, or having it fire off a function on the page that requests the second page.) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.