Heinz Stapff Posted October 5, 2011 Report Share Posted October 5, 2011 Hello gang, I've been struggling for a week to get the Ajax called elements to run the external.js file script. I used get elementbyid to place an src on a blank script tag with a function that calls the Ajax call that works and alters the innerHTML of the correct div on my index.html but can't run the js on those new well styled elements unless I hardcode the events into the get.php? So I tried creating an include 'js.php' at the bottom of the get.php but only resulted in the js.php being printed out at the bottom of the responceText. Can anybody tell me if the UniServer php INI needs to be adjusted to parse js.php files differently in order to run javascript on responceText html elements? Or do I have to hard code/inline the events on the get.php file. Which does seem to work but is nonobtrusive to say the least? Any comments greatly appreciated. Quote Link to comment Share on other sites More sharing options...
megan Posted October 5, 2011 Report Share Posted October 5, 2011 javascript is parsed by the browser and php by the server - the php server parses the php code and returns the result to the web server which passes it to the browser and then the browser handles the html, js, css client side Quote Link to comment Share on other sites More sharing options...
Heinz Stapff Posted October 5, 2011 Author Report Share Posted October 5, 2011 javascript is parsed by the browser and php by the server - the php server parses the php code and returns the result to the web server which passes it to the browser and then the browser handles the html, js, css client side megan Thanks I guess your telling me that I have to hard code the javascript events like onclick into the get.php file in order for the javascript to run which I have done like this and works: get.php echo "<img src='" . $row['src'] . "' class='image' [b][u]onclick='pictureclick()'[/u] [/b] title='Click to get a better look'/></div>"; Is this the only way to get this to work? It is obtrusive 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.