我的 javascript AJAX 代码如下。这在 Chrome 和 FF 中按预期工作,但在 IE 中,我发现 POST 变量永远不会customer_savedesign.php
低于它,但它仍然在控制台中输出“得到结果”。我认为如果我们.serialize()
在表单数据上使用 jquery 函数,IE 会起作用,但它仍然不起作用。我也没有使用.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>