就是将对象存入变量再调用就可以了!
1 $(document).ready(function(){ 2 $(".driverinfo").each(function(index){ 3 4 var html = ‘‘; 5 var object = $(this); 6 $.ajax({ 7 type: ‘post‘, 8 url: ‘‘, 9 data: {"vid":$(this).text()}, 10 success: function(data) { 11 var json = eval(‘(‘ + data + ‘)‘); 12 for (var key in json) { 13 if (key == ‘vehicleNum‘) { html += ‘运送车辆:‘+ json[key]}; 14 15 if (key == ‘customName‘) { html += ‘(司机: ‘ +json[key]+‘ )‘}; 16 } 17 18 object.text(html); 19 } 20 21 }); 22 })
时间: 2024-10-24 22:09:42