function showFindConcatDialog(mobile,uid){ $("#concatListsDialog").dialog("option", "title", "联系人显示列表"); $.ajax({ url: "findConcatinfo.action", type:"post", dataType:"json", data:{mobile:mobile,uid:uid}, success: function(data){ if (data.tip == null) { var co= data.userConcatList; var html = "<table style='font-size:16px;'><thead style='color:#1c94c4'><tr><th width='100' style='padding:5px;'>姓名</th><th width='200' style='padding:5px;'>手机</th><th width='100' style='padding:5px;'>邮箱</th></tr></thead><tbody align='center'>"; $.each(co,function(i,n){ html +="<tr><td style='padding:5px;'>"+n.realname+" </td><td style='padding:5px;'>"+n.mobile+"</td><td style='padding:5px;'>"+n.email+"</td></tr>"; }); html += "</tbody></table>" $("#concatListsDialog").html(""); $("#concatListsDialog").html(html); $("#concatListsDialog").dialog("open"); } else{ alert(data.tip); } } }); }
当然也可以直接用for遍历:
var json = {"options":"[{\"text\":\"王家湾\",\"value\":\"9\"},{\"text\":\"李家湾\",\"value\":\"10\"},{\"text\":\"邵家湾\",\"value\":\"13\"}]"} json = eval(json.options) for(var i=0; i<json.length; i++) { alert(json[i].text+" " + json[i].value) }
href="javascript:showCommRecharge();"