这是我目前所做的调整我所有的价值。这是丑陋的,太重复了。修剪json数据的最佳方法是什么?
var strHTML = '';
$.getJSON('info.php',
function(data) {
$.each(data, function(i, item) {
strHTML += $.trim(item.fname) +
$.trim(item.lname) +
$.trim(item.address) +
$.trim(item.phone) +
...(about 10 more of these);
});
});
应该有更好的方法来做到这一点。
有没有'$(项目)。每个(函数(J){strHTML中+ = $ .trim(此[J])}'??? – mplungjan 2011-03-24 17:42:15
mplungjan不起作用,我需要灵活地连接我的html和这个,但是我把它留给了混乱的b/c。 – nolabel 2011-03-24 22:21:40