jQuery deserialize form

后端 未结 11 683
日久生厌
日久生厌 2020-12-13 09:21

I am using jQuery Serialize to serialize my form elements and would like to deserialize them back. Unfortunately can\'t find any working jQuery deserializer, any suggestions

11条回答
  •  囚心锁ツ
    2020-12-13 09:41

    If what you want is to remove the standard URL-encoded notation, you can use JavaScript's decodeURIComponent(), which will give you a regular string, just like this:

    var decodedString = decodeURIComponent("Http%3A%2F%2FHello%3AWorld");
    alert(decodedString);
    

    In this case, decodedString will look like Http://Hello:World, here's a working fiddle.

    Got all of this searching for this same issue, and found the answer here: How can I decode a URL with jQuery?

    I know this is an old question, but doing some searches for jQuery deserialize got me here, so I might as well try to give a different approach on the issue for people with the same problem.

提交回复
热议问题