Below is the javascript
code used in my form:
$('#idOfButton').click(function(){
var id = $('#input').val();
$.get('index.php?r=tbltime/get-file',{ id : id },function(data){
var data = $.parseJSON(data);
alert(data);
});
});
This is the controller
code for the view:
public function actionGetFile($id)
{
$id = file_get_contents($id);
echo Json::encode($id);
}
The structure of my table
in the form view:
<table id="sampleTbl", class="table table-striped table-bordered">
<thead>
<tr id="myRow">
<th>BIB</th>
<th>Time Start</th>
<th>Time End</th>
</tr>
</thead>
<tbody></tbody>
</table>
Content of the text file
:
202#00:00:00.000000#00:02:13.045000
764#00:03:12.037300#00:04:12.123000
223#00:04:50.011000#00:05:12.045000
I'm looking to display the content of my text file into the table, however, the alert function to show the file content is not working. Can anyone provide assistance?