数据
var navJson= "[{"areaId":197,"checked":"","oflag":"","stockUp":"N","whAddress":"Keppel Distripark Blk 513 #01-130,Kampong Bahru Road ,Singapore 099449。","whCode":"SGP","whEname":"Singapore","whModifier":"","whModifydate":null,"whModifydateStart":null,"whName":"新加坡","whShipmentId":"","whStatus":"ON ","whType":"JMW"},{"areaId":230,"checked":"","oflag":"","stockUp":"N","whAddress":"51521 Bluff Drive, California, 92651,United States","whCode":"USA","whEname":"USA","whModifier":"","whModifydate":null,"whModifydateStart":null,"whName":"美国","whShipmentId":"","whStatus":"ON ","whType":"JMW"},{"areaId":215,"checked":"","oflag":"","stockUp":"N","whAddress":"2 Soi Bang Duan, Phasricharoen district, Bangkok 10150","whCode":"THL","whEname":"Thailand","whModifier":"","whModifydate":null,"whModifydateStart":null,"whName":"泰国","whShipmentId":"","whStatus":"ON ","whType":"JMW"},{"areaId":238,"checked":"","oflag":"","stockUp":"N","whAddress":"12nd Floor, Ward 20, District 10, Ho Chi Minh City, Vietnam","whCode":"VNM","whEname":"Vietnam","whModifier":"","whModifydate":null,"whModifydateStart":null,"whName":"越南","whShipmentId":"","whStatus":"ON ","whType":"JMW"},{"areaId":176,"checked":"","oflag":"","stockUp":"N","whAddress":"Old Sucat Road (beside Sapphire Aviation Academy)?Brgy. San Dionisio, Para?aque City, PHILIPPINES","whCode":"PHL","whEname":"Philippines","whModifier":"","whModifydate":null,"whModifydateStart":null,"whName":"菲律宾","whShipmentId":"","whStatus":"ON ","whType":"JMW"}]";
转换
var tjson= eval("(" + navJson + ")");
使用
$.each(tjson, function (index, item) {
if (item.whCode == wh_code) {
$('.ct-pname').text(item.whCtperson);
$('.tel-n').text(item.whCttel);
$('.p-n').text("");
$('.e-n').text("");
$('.w-n').text("");//whateapp
$('.a-v').text(item.whAddress);
}
})
});