jquery $(this).serialize()无法正常工作

时间:2012-03-26 00:13:41

标签: jquery json forms serialization this

&mobile=0400000000¬es=this+is+a+test

错误在

之上

您将看到发生以下情况¬es

应该是&notes=

我想知道为什么会这样。

这是表单HTML

<!---left--->
<div class="leadwidth">
<input type="hidden" name="task" value="MYSQL"/>
<input type="hidden" name="action" value="newlead"/>
<input type="hidden" name="fetchform" value="leadstores"/>
<input type="hidden" id="userid" name="userid" value=""/>
<input type="hidden" id="usertype" name="usertype" value=""/>
<input type="hidden" id="customerid" name="customerid" value=""/>

  <div class="formbg">Trading Name:<input name="tradingname"/></div>

<div class="formbg">Postal Street Address:<input name="streetaddress"/></div>

<div class="formbg">Postal Suburb:<input name="suburb"/></div>

<div class="formbg">Postal State:<select name="state"><option value="0">--Please Select--</option></select></div>

<div class="formbg">Postal Postcode:<input name="postcode"/></div>


<div class="formbg">Category:<select name="category"><option value="0">--Please Select--</option></select></div>

<div class="formbg formheight">Sub-Category:<select name="subcategory" MULTIPLE><option value="0">--Please Select--</option></select></div>

<div class="formbg">Membership:<input name="cmembership"/></div>

<div class="formbg">Sales Status:<select name="salesstatus"><option value="0">--Please Select--</option></select></div>

<div id="managerstatus" class="formbg">Manager Status:<select name="managerstatus"><option value="0">--Please Select--</option></select></div>

<div id="hqstatus" class="formbg">HQ Status:<select name="hqstatus"><option value="0">--Please Select--</option></select></div>

<div id="publishtoweb" class="formbg">Publish 2 Web:<select name="publishtoweb"><option value="0">--Please Select--</option></select></div>


</div>
<!---middle--->
<div class="leadwidth">
<div class="formbg">Title:<select name="title"><option value="0">--Please Select--</option></select></div>

<div class="formbg">First Name:<input name="firstname"/></div>

<div class="formbg">Last Name:<input name="lastname"/></div>

<div class="formbg">Position:<input name="position"/></div>
<div class="formbg">Web Address:<input name="webaddress"/></div>

<div class="formbg">Business Description:</div>
<textarea name="businessdescription"></textarea>

<button type="submit" id="newsubmit" class="blacksavebutton"></button>
</div>
<!---Far Right--->
<div class="leadwidth">
<div class="formbg">Company Name:<input name="companyname"/></div>

<div class="formbg">ABN/ACN:<input name="abnacn"/></div>

<div class="formbg">Email:<input name="email"/></div>

<div class="formbg">Phone Number:<input name="phonenumber"/></div>

<div class="formbg">Mobile Number:<input name="mobile"/></div>

<div class="formbg">Notes:</div>
<textarea name="notes"></textarea>
<img src="http://realcashback.com.au/v2/system/template/images/newleads/stepone_newlead.png"/>
</div>

1 个答案:

答案 0 :(得分:1)

你是如何确定的?

您看到的内容¬&not;的实体。

实际服务器接收的输入是否正确?

如果您在网页上输出此内容,则可以转换该网站。它可能在服务器上很好。

根据OP评论编辑:

$("#log ").html($(this).serialize()); 

不会逃避html实体。要解决这个问题,请使用:

$("#log ").text($(this).serialize()).html();