admin管理员组

文章数量:1298180

In some project I've met these lines:

$.get("defaults/data.json?", ...);
$.get("defaults/structure.html?", ...);
$.get("defaults/style.css?", ...);

On server side these files without any extra symbols, so I'm wondering what does the question mark at the end of files mean?

In some project I've met these lines:

$.get("defaults/data.json?", ...);
$.get("defaults/structure.html?", ...);
$.get("defaults/style.css?", ...);

On server side these files without any extra symbols, so I'm wondering what does the question mark at the end of files mean?

Share Improve this question edited Jan 30, 2012 at 14:09 Shawn Chin 87k20 gold badges167 silver badges193 bronze badges asked Jan 30, 2012 at 14:07 megasmegas 21.8k12 gold badges82 silver badges134 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 6

The ? in a URL denotes the start of the query string. A ? at the end with no variables following it is usually an unnecessary way of saying "this has absolutely no querystring".

It would be possible with a URL rewriting engine for example, to examine the ining REQUEST_URI to see if it ends with ? and take a different action than requests not ending in ?, but that would be an unusual usage. It would much more mon to just specify some value in the query string.

"?" is the separator for supplying arguments via a GET request.

? states you're providing arguments via HTTP GET.

For example if you want to send a=1 and b=2 , you would do http://mysite./myfile.php?a=1&b=2

Shai.

本文标签: javascriptWhat does the question mark at the end of filenames meanStack Overflow