I am trying to get the quantity of raw materials along with the raw material id. I send recipe id and in response I am getting array like this
[54,"Vanilla Cake Mix",2000] [126,"Water",1200] [1,"Refined Soyabean Oil",200]
Where 54 is Raw Material ID,
Vanilla Cake Mix is Raw Material Name,
And 2000 is Quantity
How do I access each value of this?
My Jquery code is
`$.ajax({
type:"POST",
url:"api_consumption.php",
data: "product_recipe_id="+product_recipe_id+"&quantity="+value,
dataType: "json",
success: function(html)
{
//I want to access the values received in json array format.
}
});`
My PHP code is
$array = array($raw_material_id, $raw_material_name, $raw_material_quantity); echo json_encode($array);
I tried the each loop but failed.