Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>tl;dr, Yes, but you need to use a server-side langauge</p> <p>This seems like a good time to explain the fineries of web server-client interaction. This is the most basic explanation:</p> <p>When a client requests a file (A page, a picture or script) the server looks for it in the appropriate folder. If it isn't found it sends a familiar 404 code back, or if it is found, it sends the contents of that file back (wrapped in http headers of course).</p> <p>When it comes to dynamic pages (like <code>.php</code> files) the web server has to act slightly differently. Before sending them to the client, the server runs the file through a program called a parser. It then sends the output of the parser back to the client (The parser can also modify headers). The request variables (The bit after the '?' in the URL, or the variables sent by a POST request) are available to the dynamic script in some manner. In PHP they're available using the $_GET/POST globals. These variables are parsed by the server, not the client, so you can have them anywhere.</p> <p>Now, specifically to your problem, when you use a <code>&lt;script&gt;</code> tag, the client asks for the file specified by the <code>href</code> attribute. This doesn't have to be a <code>.js</code> file, that's just convention. The <code>type</code> attribute tells the client what type of file it is. If you write PHP (or other) code to generate Javascript (even if its just <code>include 'file1.js'</code>) you can use PHP to grab the sent GET/POST variables. Then the Javascript sent is executed by the client.</p> <p>Sorry if this covers stuff you already know, I'm just trying to be complete</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload