icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.
Old February 5th, 2006, 5:21 PM   #1 (permalink)
Registered User
Seasoned Poster
 
Joined in Jan 2006
Lives in UK
Hosted on SHA91
42 posts
Gave thanks: 1
Thanked 0 times
Exclamation JavaScript Handler?

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

Site: http://www.lankymart.com/
Server: SH91 (72.29.92.31)
lankymart is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old February 5th, 2006, 6:00 PM   #2 (permalink)
H
after g, before i
Resident.
 
H's Avatar
 
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>
I can't imagine the subdomain to be an issue unless there's some sort of remote blocking on the subdomain. And it is common, depending on the browser, to show the JavaScript rather than prompt for a download.
H is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old February 5th, 2006, 9:09 PM   #3 (permalink)
Registered User
Seasoned Poster
 
Joined in Jan 2006
Lives in UK
Hosted on SHA91
42 posts
Gave thanks: 1
Thanked 0 times
Unhappy

I have included the JavaScript as you have stated but it does not appear to be firing, unlike when I place it straight into the page.
__________________
LankyMart

Site: http://www.lankymart.com/
Server: SH91 (72.29.92.31)
lankymart is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old February 5th, 2006, 9:40 PM   #4 (permalink)
H
after g, before i
Resident.
 
H's Avatar
 
Joined in Jul 2004
Lives in N,BC,CA
8,092 posts
Gave thanks: 48
Thanked 131 times
Can you provide us with a link to check it out?
H is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old February 6th, 2006, 4:25 AM   #5 (permalink)
Registered User
Seasoned Poster
 
Joined in Jan 2006
Lives in UK
Hosted on SHA91
42 posts
Gave thanks: 1
Thanked 0 times
The link is in my sig.
__________________
LankyMart

Site: http://www.lankymart.com/
Server: SH91 (72.29.92.31)

Last edited by lankymart; February 6th, 2006 at 4:27 AM..
lankymart is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old February 6th, 2006, 4:30 AM   #6 (permalink)
H
after g, before i
Resident.
 
H's Avatar
 
Joined in Jul 2004
Lives in N,BC,CA
8,092 posts
Gave thanks: 48
Thanked 131 times
My bad.. Signatures disabled...
H is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old February 6th, 2006, 4:37 AM   #7 (permalink)
H
after g, before i
Resident.
 
H's Avatar
 
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?
H is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old February 6th, 2006, 4:44 AM   #8 (permalink)
Registered User
Seasoned Poster
 
Joined in Jan 2006
Lives in UK
Hosted on SHA91
42 posts
Gave thanks: 1
Thanked 0 times
Ok, for you people with sigs disabled....here's the url...

http://www.lankymart.com/
__________________
LankyMart

Site: http://www.lankymart.com/
Server: SH91 (72.29.92.31)
lankymart is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old February 6th, 2006, 5:16 AM   #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.
__________________
LankyMart

Site: http://www.lankymart.com/
Server: SH91 (72.29.92.31)
lankymart is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On