I have the following code to create a datatable.
Instead of return json result from my php file, it returns the php file itself.
I checked the php file on localhost page and it seems the php file is working fine:
{"draw":0,"recordsTotal":115,"recordsFiltered":115,"data":[{"chr":"chr1","pos":631704},{"chr":"chr1","pos":631714},{"chr":"chr1","pos":631848},{"chr":"chr1","pos":632344},{"chr":"chr1","pos":632461},{"chr":"chr1","pos":633015},{"chr":"chr1","pos":633143},{"chr":"chr1","pos":633300},{"chr":"chr1","pos":633364},{"chr":"chr1","pos":633839},{"chr":"chr1","pos":633852},{"chr":"chr1","pos":633860}............
Could someone help me with it?
I tried this answer by adding
PHP code is not being executed, but the code shows in the browser source code
LoadModule php_module "C:/xampp/php/php8apache2_4.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
but still didn't work.
`<script>
$(document).ready(function() {
$('#example').DataTable( {
"processing": true,
"serverSide": true,
"ajax": {url : "example.php",
type: "GET",
},
"columns": [
{ "data": 'chr'},
{ "data": 'pos'}
]
} );
} );
</script>`
Thank you.