I am using DataTabels with PHP, AJAX, jQuery.
I get some data from MySQL database and when it contains some specific characters, then it crashes (characters like ä ü õ etc).
Here is where I "fetch data" to my table:
function fetch_data()
{
var dataTable = $('#user_data').DataTable({
"processing" : true,
"serverSide" : true,
"order" : [],
"ajax" : {
url:"fetch.php",
type:"POST"
}
});
}
and this is my fetch.php
where I make the output :
$output = array(
"draw" => intval($_POST["draw"]),
"recordsTotal" => get_all_data($connect),
"recordsFiltered" => $number_filter_row,
"data" => $data
);
echo json_encode($output);
I tried to add
contentType: "application/json; charset=utf-8",
dataType: "json",
To fetch_data
function, but then my result just went empty... Where am I wrong?