I have the following json data, which is located in the url http://localhost/stock/index.php/masterfiles/itemgriddata
[{"name":"asdasd","code":"123","id":"1","unit":"Nos","purprice":"25000"},{"name":"Item2","code":"1235","id":"2","unit":"Nos","purprice":"0"}]
I want to get the value of name and code where id equal to 1, and store them as variables using jquery .
I know there is a method like,
$.getJSON('http://localhost/stock/index.php/masterfiles/itemgriddata', function(data) {
console.log(data);
});
but I don't know how to implement it. Can any one help me find the solution?