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
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).
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

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.