View Single Post
Old 01-29-2013, 01:46 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,100
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by hno2005 View Post
Hi every one
I need to send an id to a JavaScript file . this is my code :
<script src="test.js" language="javascript" ></script>

I want to post data , something like this :
<script src="test.js?id=5" language="javascript" ></script>

is it possible ?
How can I send an id to a javascript file ?

Thanks
Not possible. (Why do you want to do that??) JavaScript running in the browser does not have any commands for reading or writing files. In any case for security reasons JavaScript cannot access anything beyond the domain of the current page. This is known as the "same origin policy" and prevents a document or script loaded from one origin from getting or setting properties of a document from a different origin.


Be aware that script language="javascript" is long obsolete.

St.John the blacksmith dumped water on his head.
- Pupil's answer to Catholic Elementary School test.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote