给出以下形式:
<form>
<input name="foo" value="bar">
<input name="hello" value="hello world">
</form>
Run Code Online (Sandbox Code Playgroud)
我可以使用$.param( .. )构造来序列化表单:
$.param( $('form input') )
=> foo=bar&hello=hello+world
Run Code Online (Sandbox Code Playgroud)
如何用JavaScript反序列化上面的String并获取哈希值?
例如,
$.magicFunction("foo=bar&hello=hello+world")
=> {'foo' : 'bar', 'hello' : 'hello world'}
Run Code Online (Sandbox Code Playgroud)