What does “?”, used after JavaScript filename, means?

后端 未结 6 1585
悲&欢浪女
悲&欢浪女 2020-12-10 13:24

For example, having:


So what

6条回答
  •  [愿得一人]
    2020-12-10 14:03

    It means a variable is being passed to the script via GET, though standard JavaScript files don't support any means of collecting the variable.

    You could, however, write a server script in PHP or ASP.NET that sets the content type as application/x-javascript.

    Like this in php:

    // file: external.php
    
    // regular javascript here that uses $_GET['variable'];
    

    Then you could put this in your HTML script tag:

    
    

提交回复
热议问题