简体   繁体   English

如何在“ jquery序列化表单”后解读html

[英]how to unscramble html after “jquery serialize form”

OK I guess it's not a matter of scrambling as much as encoding... But when I take HTML from a form field and pass it through jQuery serialize, all the special characters get changed so if I want to output the HTML as actual HTML to be rendered as such in browser, what is the easiest way? 好的,我想这与其说是编码,不如说是加扰……但是当我从表单字段获取HTML并将其通过jQuery序列化传递时,所有特殊字符都会更改,因此如果我想将HTML作为实际HTML输出到在浏览器中如此渲染,最简单的方法是什么?

So this... 所以这...

<div id="object_01" class="object_textbox ui-draggable ui-resizable" namn="object_01" style="z-index: 1; font-family: Arial;"><div class="object_inner" style="border:solid 1px #000;background-color:#fff;border-radius:100%;"></div><div class="ui-resizable-handle ui-resizable-e" style="z-index: 1000;"></div><div class="ui-resizable-handle ui-resizable-s" style="z-index: 1000;"></div><div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se" style="z-index: 1000;"></div></div>

Turns something like... 变成...

%0D%0A%09%09%3Cdiv+id%3D%22object_01%22+class%3D%22object_textbox%22+namn%3D%22object_01%22+style%3D%22z-index%3A+1%3B+font-family%3A+Arial%3B%22%3E%3Cdiv+class%3D%22object_inner%22+style%3D%22border%3A+1px+solid+rgb(0%2C+0%2C+0)%3B+background-color%3A+rgb(255%2C+255%2C+255)%3B+border-top-left-radius%3A+100%25%3B+border-top-right-radius%3A+100%25%3B+border-bottom-right-radius%3A+100%25%3B+border-bottom-left-radius%3A+100%25%3B+cursor%3A+move%3B%22%3E%3C%2Fdiv%3E%3C%2Fdiv%3E

正如对该问题的评论所暗示的那样,php方法urldecode()是将所有特殊字符恢复为字符串以进行HTML渲染的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM