Jump to content

Redirecting Javascript s


sazzie

Recommended Posts


I have 2 javascripts. Script1.js is in a directory which is parent to another directory containing a php script and script2.js.

Can someone please tell me how to redirect my php script to use the first javascript in the parent directory.

So if I have the following declaration in a php script:
[code]
<script language="JavaScript" src="script2.js"> </script>
[/code]

How can I get the php script to utilize a 'script1.js' which is in the parent directory?

thanks  :)
Link to comment
https://forums.phpfreaks.com/topic/34872-redirecting-javascript-s/
Share on other sites

'um maybe I don't get the question?

it sounds like you just need to change[code]<script language="JavaScript" src="script2.js"> </script>[/code] to[code]<script language="JavaScript" src="script1.js"> </script>[/code]

this would run script1.js instead of script2.js

what am I missing?
when you talk about a "parent" directory, you may need to change how the script looks for the source.  update the path like:

src="/parentdirectory/subdirectory/script1.js"
or just
src="../script1.js"

depending on your file structure.

on another note[quote]get the php script to utilize a 'script1.js'[/quote]PHP can't utilize javascript because PHP is run server-side and, after being processed on your webserver, is sent to the end user who's browsers renders the server code and then applies the javascript (which only runs client-side).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.