javascript jQuery.param() 的反面

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6294255/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 20:12:25  来源:igfitidea点击:

The opposite of jQuery.param()

javascriptjquery

提问by Florian Fida

If you serialize a object with $.param()how do i get it back?

如果你序列化一个对象,$.param()我该如何取回它?

in php there is parse_strbut i didn't find anything like it in javascript.

在 php 中有,parse_str但我没有在 javascript 中找到类似的东西。

TL&DR: Turns out that parse_strhas been ported to javascript:
http://phpjs.org/functions/parse_str/

TL&DR:结果parse_str已被移植到 javascript:http:
//phpjs.org/functions/parse_str/

回答by sgokhales

Check this : Javascript / Jquery: $.param( ) inverse function.

检查这个:Javascript/Jquery:$.param() 反函数

You can also go for Deserializer of Jquery.

您也可以选择Deserializer of Jquery

jquery.deserialize is a very simple jQuery plugin providing 'deserialize' functionality to a form elements.

jquery.deserialize 是一个非常简单的 jQuery 插件,为表单元素提供“反序列化”功能。

回答by ek_ny

Not sure if it's included in jquery, but look at http://www.json.org. There is file that you can use and do JSON.parse(). I think firefox has native support for it, but I don't think IE does.

不确定它是否包含在 jquery 中,但请查看http://www.json.org。您可以使用并执行 JSON.parse() 文件。我认为 Firefox 对它有本机支持,但我认为 IE 没有。