在jQuery.getJSON它说:
Data that is sent to the server is appended to the URL as a query string
这个字符串的格式是什么?我看到这种格式的 url 来自客户端的这样一个 jquery json 调用:
http://<domain:port/path/something.html?somevalue=a;othervalues=1,2,3,4;v=3
这个格式是json特有的吗?我一般认为附加到 URL 的参数由 &
分隔
最佳答案
What is the format of this string?
可以为该属性指定一个对象或字符串的值。
如果给它一个对象,那么它的键和值将被格式化为application/x-www-form-urlencoded
数据(就像表单提交一样)。
如果给它一个字符串,它将是该字符串的任何内容 — 因此它可以是“使用它的代码的作者希望它成为什么”。
I see a url of this format…
那就是“无论作者想要什么”的情况。请注意,;
和 &
可以在许多 application/x-www-form-urlencoded
解码库中互换使用。这是 recommended by the HTML 4 specification .
Is this format specific to json?
没有。用于发出请求的 URL 的数据格式与响应的数据格式之间没有联系。
关于jquery - json 查询字符串中的 URL 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16595230/