-1
我有一個表單頁面,我需要在提交之前做一些AJAX的東西,我使用序列化[解析它,但是表單輸入名稱中有周期字符(我無能爲力,它是一個CRM quirk)這是打破阿賈克斯 - 我怎麼能在這種情況下逃脫他們?主要形式是:如何在使用Jquery序列化時轉義字符?
<form action="http://content.stuff.com" id="myid" class="form" method="POST" name="PPCform" >
<input name="uPEw.zMtH4.ptrq8qzoLXcwu7t87tfw2u" type="hidden" />
<input name="yP7h.zGDK46p8rq8qzJYDnru9D87Zfw2y" placeholder="Email" type="text" value="">
<input type="submit" id="button-blue" value="SUBMIT AND CONTINUE" />
</form>
和腳本是:
$("form").submit(function (event) {
event.preventDefault();
//FB pixel, other stuff
$.post($(this).attr('action'), $(this).serialize())
.done(function() {
// redirect, etc.
});
});
但這並不因工作。在名字中。由於我沒有單獨抓住他們,所以我不能使用通常的// escape方法。任何想法如何指示序列化來逃避期間?
你說的* 「打破了Ajax」 的*是什麼意思? – Phil
剛剛給了這個快速嘗試,值被序列化並正確提交,例如'yP7h.zGDK46p8rq8qzJYDnru9D87Zfw2y = email @ example.com' – Phil