I have JSONResults in my Controller that contains all the data from a table. On the client's HTML detail view page, I am using JavaScript to fetch this data. How do I extract data from JSON where the client name is equal to klID (this is a JSON string with the client's name)?
I have attempted the following code but it retrieves all the data:
for (var i = 0; i < json.length; i++) {
$.data = (json[i].klID = "@Html.DisplayFor(model => model.klient)");
var dateString = json[i].datum.substr(6);
var currentTime = new Date(parseInt(dateString));
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
var date = day + "/" + month + "/" + year;
tr = $('<tr/>');
tr.append("<td>" + json[i].pID + "</td>");
tr.append("<td id='date'>" + date + "</td>");
tr.append("<td>" + json[i].description + "</td>");
tr.append("<td>" + json[i].popust + "</td>");
$('table').append(tr);
Please help me. Thank you.