How to set data from jsonresponse
How to set data from jsonresponse
When user clicks report button on my page , it starts to run my service and return jsonresponse , and I want to set this response to datatable ? All How can I do? Please help
My Class
public class DosyaMasrafList
{
public String Dosya_No;
public String Fatura_Tarihi;
public String Ithal_Ulke;
}
My Service
[WebMethod]
public JsonResponse<List<DosyaMasrafList>> DosyaMaliyetRapor(string Tarih1,string Tarih2)
{
JsonResponse<List<DosyaMasrafList>> response = new JsonResponse<List<DosyaMasrafList>>()
{
Data = new List<DosyaMasrafList>(),
Success = true,
Message = ""
};
response.Data = DosyaMasrafDB.DosyaMaliyetRapor(Tarih1, Tarih2);
return response;
}
My page
</div>
<div class="portlet-content">
<div class="table-responsive">
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Dosya No</th>
<th>Fatura Tarihi</th>
<th>İthal Ülke</th>
</tr>
</thead>
</table>
<div id="Container">
</div>
</div>
My jscript
loadDosyaMaliyetRapor= function () {
axaAjax({
url: "../Services/ZeusRepWeb.asmx/DosyaMaliyetRapor",
data: JSON.stringify({
Tarih1: $("#Tarih1").val(),
Tarih2: $("#Tarih2").val()
}),
success: function (msg) {
if (msg.d.Success) {
var a = {
d: msg.d.Data
}
var table = $('#example').DataTable(); ?????? how to use
}
}
});
},