I'm trying to add my serialized List in a .txt file and then add it to my jQuery Datatable using an Ajax call, however I got an error in the first line of my Ajax. Can someone tell me what I'm doing wrong?
This is my path.txt (serialized List):
["ENS FRUTAS","REST","CENAS","$26.50",0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,"$26.50"]
This is my DataTable-filling JavaScript:
$(document).ready(function () {
var table = $('#pftable_hdr').DataTable({
"ajax": {
"url": "/path.txt",
"dataSrc": ""
},
"columns": [
{ "data": "Descripcion" },
{ "data": "Pdv" },
{ "data": "Rid" },
{ "data": "PV" },
{ "data": "1" },
{ "data": "2" },
{ "data": "3" },
{ "data": "4" },
{ "data": "5" },
{ "data": "6" },
{ "data": "7" },
{ "data": "8" },
{ "data": "9" },
{ "data": "10" },
{ "data": "11" },
{ "data": "12" },
{ "data": "13" },
{ "data": "14" },
{ "data": "15" },
{ "data": "16" },
{ "data": "17" },
{ "data": "18" },
{ "data": "19" },
{ "data": "20" },
{ "data": "21" },
{ "data": "22" },
{ "data": "23" },
{ "data": "24" },
{ "data": "25" },
{ "data": "26" },
{ "data": "27" },
{ "data": "28" },
{ "data": "29" },
{ "data": "30" },
{ "data": "31" },
{ "data": "Total" },
{ "data": "Cantidad" }
],
scrollY: "500px",
scrollX: true,
scrollCollapse: true,
fixedColumns: {
leftColumns: 3
}
});
});
And this is my HTML table code:
<table class="table table-hover no-more-tables table-iconmebanquet-detail" id="pftable_hdr">
<thead>
<tr>
<th style="">Descripcion</th>
<th style="">Pdv</th>
<th style="">Rid</th>
<th style="">PV</th>
<th style="">1</th>
<th style="">2</th>
<th style="">3</th>
<th style="">4</th>
<th style="">5</th>
<th style="">6</th>
<th style="">7</th>
<th style="">8</th>
<th style="">9</th>
<th style="">10</th>
<th style="">11</th>
<th style="">12</th>
<th style="">13</th>
<th style="">14</th>
<th style="">15</th>
<th style="">16</th>
<th style="">17</th>
<th style="">18</th>
<th style="">19</th>
<th style="">20</th>
<th style="">21</th>
<th style="">22</th>
<th style="">23</th>
<th style="">24</th>
<th style="">25</th>
<th style="">26</th>
<th style="">27</th>
<th style="">28</th>
<th style="">29</th>
<th style="">30</th>
<th style="">31</th>
<th style="">Total</th>
<th style="">Venta</th>
</tr>
</thead>
<tfoot>
<tr>
<th style="">Descripcion</th>
<th style="">Pdv</th>
<th style="">Rid</th>
<th style="">PV</th>
<th style="">1</th>
<th style="">2</th>
<th style="">3</th>
<th style="">4</th>
<th style="">5</th>
<th style="">6</th>
<th style="">7</th>
<th style="">8</th>
<th style="">9</th>
<th style="">10</th>
<th style="">11</th>
<th style="">12</th>
<th style="">13</th>
<th style="">14</th>
<th style="">15</th>
<th style="">16</th>
<th style="">17</th>
<th style="">18</th>
<th style="">19</th>
<th style="">20</th>
<th style="">21</th>
<th style="">22</th>
<th style="">23</th>
<th style="">24</th>
<th style="">25</th>
<th style="">26</th>
<th style="">27</th>
<th style="">28</th>
<th style="">29</th>
<th style="">30</th>
<th style="">31</th>
<th style="">Total</th>
<th style="">Venta</th>
</tr>
</tfoot>
</table>
How can I make my Ajax call to fill my DataTable with the data in my .txt file?