我的JavaScript Ajax代码如下。 这将按预期在Chrome和FF,但在IE中,我发现了POST变量从未使其customer_savedesign.php
下方,但它仍然给在控制台输出“得到的结果”。 我想,如果我们使用jQuery的IE浏览器将工作.serialize()
函数的表单数据,但它仍然没有工作。 我还没有使用.submit()
只需直接调用Ajax。
$.ajax({
type: "POST",
url: "customer_savedesign.php",
data: $('#designform').serialize(),
success: function(data)
{ arr = data.split(':');
console.log("got result");
// show response from the php script.
console.log("arr1 is " + arr[1]);
}
});
编辑
我的形式如下:
<div class='lefttable'>
<form id='designform' name='designform' method='post' action='customer_savedesign.php'>
<table style='margin-top:20px;text-align:right; bidi-direction:rtl; font-size:12pt' class='form' id='arabic-fields'>
<tr><td>اسم الشركة</td></tr>
<tr><td> <textarea tabindex="1" type='text' class='large ar arindic expand20-60' id='ar_Company_Name' style='bidi-direction:rtl; text-align:right;'></textarea> </td></tr>
<tr><td>رسالة الشركة</td></tr>
<tr><td> <textarea type='text' tabindex="1" class='large ar arindic expand20-60' id='ar_Company_Message' style='bidi-direction:rtl; text-align:right;'></textarea> </td></tr>
</table>
<input type='button' id='newfield' class='ar newfield' value='نص جديد' />
<input type='hidden' id='state_history' style='width:300px; height:30px;' />
<input type='hidden' id='current_state' style='width:300px; height:30px;' />
<input type='hidden' name='designid' id='designid' value='<?php echo $d->getID(); ?>' />
<input type='hidden' name='parentid' id='parentid' value='<?php echo $d->getParentID(); ?>'/>
<input type='hidden' name='productid' id='productid' value='0'/>
<input type='hidden' name='templateid' id='templateid' value='0'/>
<input type='hidden' name='orientation' id ='orientation' value='<?php echo $orientation; ?>' />
<input type='hidden' name='side' id='side' value='<?php echo $side; ?>' />
<input type='hidden' name='userid' id='userid' value='<?php echo $user_id; ?>'/>
<input type='hidden' name='usertype' id='usertype' value='<?php echo $user_type; ?>'/>
<input type='hidden' name='designdata' id='designdata' />
<input type='hidden' name='designtag' id='designtag' />
<input type='hidden' name='orderdetailid' id='orderdetailid' value='<?php echo $order_detail_id; ?>' />
<input type='hidden' name='wasnew' id='wasnew' value='<?php echo $wasnew; ?>' />
<input type='hidden' name='action' id='action' value='<?php echo $_GET['action']; ?>' />
<input type='hidden' name='saveasaction' id='saveasaction' />
</form>
</div>