jquery - json 查询字符串中的 URL 格式

标签 jquery html ajax json query-string

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/

相关文章:

javascript - 通过 json 发送 3 个变量未正确发送

JQueryMobile - 用图像替换复选框打勾 - 完整的 CSS

jquery - jQuery展开/折叠div在IE7/IE9中不起作用

javascript - JQM : Why does the same jQuery selector return a different number of elements depending on the current page?

javascript - CSS 曲线渐变和盒子阴影

html - 如何在上面堆一大堆,然后堆放两小堆,然后再堆一大堆

javascript - 动画 html 元素 - flexslider

javascript - ad.unshift()、content中的内容是什么意思?

php - 下拉菜单适用于除 Internet Explorer 之外的所有浏览器

Ruby/Sinatra Ajax 驱动的应用程序操作指南