I am attempting to load a text file into JQuery DataTables. This is my HTML I have set-up for the button press
<div style="text-align:center;padding:20px 0px 0px 0px;">
<span class="badge badge-info" style="font-size: 1.5rem; font-weight: 700;padding-bottom: 10px;margin-bottom: 20px;" id="txtFile">Get Registered Names</span>
</div>
And this is the html I have setup for the actual JQuery Datatable
<div>
<table id="tblData" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
</table>
</div>
And this is the JQuery I am wanting to use to load the table from the text file
$(function (){
$('#txtFile').click(function() {
$('#tblNames').dataTable({
"ajax": 'registeredusers.txt',
"columnDefs":
[{
"data": "Name"
}]
});
});
});
This file is located in /var/www/html/ and I want to display it to the user on a button press event. How would I do this?
"ajax": "data/object.txt",to my local path of'"ajax": "/var/www/html/names.txt""ajax": "names.txt"DataTables warning: table id=tblDomains - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1