function paintOrders(DivId) {
var container = '<div>';
$.each(DivId, function () {
container += 'TXT' + '<br/><br/>';
});
container += '</div>';
$('#div_' + DivId).append(container);
}
ShipmentNum
是唯一ID
我需要将txt附加到其中的div是另一个div和另一个div
<div id="leftGrid" style="position: relative;float:left;width:50%;">
<div>
<div id="div_11626">11626----</div>
<br>
<div id="div_12109">12109----0</div>
<br>
<div id="div_13089">13089----</div>
<br>
</div>
</div>
$('#div_' + items).append(container);
错误未捕获异常:语法错误,无法识别的表达式: [object Object]
调用函数
function paintShipments(items) {
var div = $('<div/>');
$.each(items, function () {
var shipment = this.Shipment;
$('<div id="div_' + this.Shipment + '">' + this.Shipment + '----' + this.DriverNames + '---' + this.Kavs + '</div>').click(function () {
_Services.invoke({
method: 'GetOrdersGrid',
data: { ShipmentNumber: shipment },
success: function (shipment) {
paintOrders(shipment);
}
});
}).appendTo(div);
$('<br/>').appendTo(div);
});
$("#leftGrid").append(div);
}
答案 0 :(得分:1)