我在执行每个Ajax请求时在表标记中附加一些html。我需要在执行ajax请求后立即显示附加的html。 它在FF中工作正常,但在IE中它只在完成所有ajax请求后显示附加的html。
以下是代码
while(cond)
{
$.ajax({
// other codes
success: function(data) {
$('#tblPOUpdateResult tr:last').after(GetHtmlFromProblems(data));
}
});
}
function GetHtmlFromProblems(data) {
var output = "";
output = "<tr><td>" + data.PurchaseOrderNumber + "</td><td>";
if (data.Result.WasSuccessful == true) {
output = output + "<div style='color: green'> Sucess </div></td><td>";
}
else {
output = output + "<div style='color: red'>Failed</div></td><td>";
}
if (data.Result.Problems.PurchaseOrderNotFound == true) {
output = output + "Purchase order was not found";
}
if (data.Result.Problems.NoChangesToSave == true) {
output = output + "There is no change to update <br />";
}
if (data.Result.Problems.PurchaseOrderIsForADifferentVendor == true) {
output = output + "Purchase Order belongs to a different vendor <br />";
}
if (data.Result.Problems.PurchaseOrderIsNotDirectShip == true) {
output = output + "Purchase Order is not Direct ShipSet <br />";
}
if (data.Result.Problems.LineIsNotForSpecifiedPart == true) {
output = output + "Purchase Order Line is specified for different part <br />";
}
if (data.Result.Problems.QuantityReceivedExceedsQuantityOrdered == true) {
output = output + "Quantity received exceeded quanity ordered <br />";
}
if (data.Result.HasAnyProblem == false) {
output = output + "There is no problem<br />";
}
output = output + "</td></tr>";
return output;
}
Html页面:
<div id="PurchaseOrderUpdateResults">
<table cellspacing='0' class='grid_table bordered no_table_padding no_wrap_table' id="tblPOUpdateResult">
<tbody>
<tr>
<th>
Purchase Order Number
</th>
<th>
Status
</th>
<th>
Problems
</th>
</tr>
</tbody>
</table>
</div>
非常感谢任何帮助:)我使用IE 7。
答案 0 :(得分:0)
尝试这里给出的table-layout属性:
http://msdn.microsoft.com/en-us/library/ms531161%28v=VS.85%29.aspx
您可以优化表格渲染 通过指定的性能 tableLayout属性。这个性质 导致Windows Internet Explorer 一次渲染一行表, 为用户提供信息 加快步伐。
HTH
答案 1 :(得分:0)
我自己找到了解决方案。
追加不起作用的原因是我的jQuery ajax请求是同步的。即)我在ajax函数中设置了async:false属性。
删除异步属性后。它运作正常:))