3
4 5 "/> 3 4 5 ">Home >Web Front-end >JS Tutorial >About serialize serialization and sign processing example code
Talk less and do more, run the code directly, there are comments in the code:
nbsp;html> 2 3 4 <meta> 5 <meta> 6 <title>serialize 序列化 +号处理</title> 7 8 921 <script></script>22 <script>23 $(function(){24 $('#btn').click(function(){25 //serialize序列化,默认会调用encodeURIComponent()进行编码26 var pre = $('#form').serialize()27 //r1=%E5%89%8D%E7%AB%AF%E5%B7%A5%E7%A8%8B%E5%B8%88++%E5%8E%89%E5%AE%B3%EF%BC%8128 //注意有+号29 console.log(pre);30 //对整个字符串中符合条件的+号都进行替换31 var next = pre.replace(/\+/g," ");32 //对serialize后的内容进行解码33 next = decodeURIComponent(next);34 //r1=前端工程师 厉害!35 //注意没有+号了36 console.log(next)37 });38 });39 </script>40 41
The above is the detailed content of About serialize serialization and sign processing example code. For more information, please follow other related articles on the PHP Chinese website!