|
|
#1 (permalink) |
|
Registered User
Seasoned Poster
Joined in Jan 2006
Lives in UK
Hosted on SHA91
42 posts
Gave thanks: 1
Thanked 0 times
|
Hi,
I'm trying to use JavaScript in a PHP page, so far when I embed the script in the file my code works but I want to hold the JavaScript in another file and use src attribute of the script tag to point it to the remote file. The file exists in a separate sub domain would this stop it working? Also when I type the full address of the js file into a browser (firefox) it shows the file as text on the screen instead of asking me if I want to download the file, is this normal? Is this perhaps a problem with my mime types or something similar? Please help. ![]() |
|
|
|
|
|
#2 (permalink) |
|
after g, before i
Resident.
Joined in Jul 2004
Lives in N,BC,CA
8,092 posts
Gave thanks: 48
Thanked 131 times
|
I use JavaScript files with PHP all the time. Make sure you're including the JavaScript file like so:
Code:
<script type="text/javascript" src="link/to/file"></script> |
|
|
|
|
|
#7 (permalink) |
|
after g, before i
Resident.
Joined in Jul 2004
Lives in N,BC,CA
8,092 posts
Gave thanks: 48
Thanked 131 times
|
All looks to be ok... I can't figure out why it wouldn't be working. But just out of curiousity, is there anything to show that it has or hasn't worked?
|
|
|
|
|
|
#9 (permalink) |
|
Registered User
Seasoned Poster
Joined in Jan 2006
Lives in UK
Hosted on SHA91
42 posts
Gave thanks: 1
Thanked 0 times
|
It turns out to be a typo in my code, man I feel so stupid. I restored my script from backup and forgot to make certain changes to it.
Thank you again for all your help. |
|
|
|