这是我的表单提交数据并转换为json对象现在我得到" invoice [exporter_id]"重视如何获得它??
{
"top-search": "",
"utf8": "✓",
"_method": "patch",
"invoice[orders_attributes][0][ctns]": "10",
"invoice[orders_attributes][0][packing_type]": "2 * 10 LBS",
"invoice[orders_attributes][0][quantity]": "10",
"invoice[orders_attributes][0][rate]": "10.0",
"invoice[orders_attributes][0][amount]": "100.0",
"invoice[orders_attributes][0][_destroy]": "false",
"invoice[orders_attributes][0][id]": "55e5792bf8e6c23342000090",
"invoice[grossweight]": "",
"invoice[invoicevalue]": "100.0",
"invoice[netweight]": "10.0",
"invoice[freight]": "10.0",
"invoice[MPF]": "10.0",
"invoice[addpercentage]": "1.0",
"invoice[ADD]": "0.78",
"invoice[hmfpercentage]": "0.125",
"invoice[HMF]": "0.1",
"invoice[FOB]": "79.12",
"invoice[exporter_id]": "55e56c80f8e6c2334200006b",
"invoice[plant_id]": "55e56cfff8e6c2334200006c",
"invoice[consignee_id]": "55e566a8f8e6c23342000044",
"invoice[precarriageby]": "",
"invoice[placeofreceipt]": "",
"invoice[origincountry_id]": "",
"invoice[originport_id]": "",
"invoice[vessel]": "",
"invoice[containerno]": "",
"invoice[bdate]": "",
"invoice[terms]": "",
"invoice[destinationcountry_id]": "",
"invoice[destinationport_id]": "",
"invoice[destination_id]": "",
"invoice[clearing_agent_id]": "",
"invoice[ddate]": "",
"invoice[status]": "Inprogress",
"invoice[remarks]": ""
}
我需要"发票[exporter_id]"怎么弄它..?
答案 0 :(得分:1)
尝试使用parseJSON呈现数据
var json = jQuery.parseJSON(obj);
alert(json["invoice[exporter_id]"]);