Jump to content
The Uniform Server Community

responceText include js.php file printed out

Heinz Stapff

Recommended Posts

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. ;)

Link to comment
Share on other sites

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:



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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...