Reputation: 669
This is my form submit data and converted into json object now i get "invoice[exporter_id]" value how to get it..?
{
"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]": ""
}
I need "invoice[exporter_id]" how to get it..?
Upvotes: 1
Views: 68
Reputation: 11808
Try parseJSON to render data
var json = jQuery.parseJSON(obj);
alert(json["invoice[exporter_id]"]);
view the document http://api.jquery.com/jquery.parsejson/
Upvotes: 1