im using asp.net mvc, want to load json data from server side. I have that piece of server side code:
Function GetData() As ActionResult
Dim TransactionSearchRow1 = New TransactionSearchRow With {
.status = Status.Cancelled,
.transactinId = 12345,
.creditCardNumber = "1234324324",
.supplier = "Office Depot",
.createdAt = New DateTime(2008, 12, 28),
.amount = 500
}
Dim TransactionSearchRowJson = JsonConvert.SerializeObject(TransactionSearchRow1)
Return Json(TransactionSearchRowJson)
End Function
Its just send me back json string from a TransactionSearchRow object.
I have that client-side code:
$("#searchBTN").on("click", function () {
$.ajax({
url: '/Transaction/GetData',
method: 'POST',
dataType: 'json',
success: function (data) {
$('#TransactionTable').dataTable({
data: data,
columns: [
{ 'data': 'status' },
{ 'data': 'transactinid' },
{ 'data': 'creditcardnumber' },
{ 'data': 'supplier' },
{ 'data': 'createdAt' },
{ 'data': 'amount' }
]
});
}
});
});
And simple HTML table:
<table id="TransactionTable" class="table table-striped table-bordered table-list">
<thead>
<tr>
<th class="col-md-1">Status</th>
<th>TransID</th>
<th>CCN</th>
<th>Supplier</th>
<th>Created Date</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
</tbody>
</table>



datain the success function returns correct?