Show the variable data
Show the variable data
Tommy_G
Posts: 3Questions: 1Answers: 0
Hello, i am new to this.
How can i show the variable fundResults data on the datatables.
The fundsResults gets a result like "fundresult = Array [17]". Each array is an object with two property. Example:
FundName: "Example fund"
IsAvailable: false
So the result i want is two columns one is the name and the second is availability.
My code looks like following:
$('#searchButton')
.click(function () {
var searchInput = $('#searchInput').val();
$.ajax({
url: '@Url.Action("FindFunds", "ManageFund")',
type: 'POST',
data: { searchInAllFunds: searchInput },
success: function (data) {
var funds = $.parseJSON(data);
var fundResult = funds.fundResult;
$('#NEWTABLE').DataTable({
"data": fundResult,
"columns": [{ "data": "FundName" },
{ "data":"IsAvailable"}],
"pageLength": 15,
"lengthMenu": [15, 25]
}
});
}
});
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Because of reasons that code is working now.
Just checking - are you saying that it is working as you want now?
Allan
Yes, thank you
The code i posted suddenly worked. I don't know why. Maybe because i restarted visual studio.