Search name with apostrophe inside mysql datatable.
Search name with apostrophe inside mysql datatable.
m75sa
Posts: 132Questions: 30Answers: 0
Hi,
i'm using datatable plugin and works well except when i try to search records that contains apostrophs.
The problem is that the
$requestData['search']['value'])
doesn't pass the apostroph from the ajax function i have in the master file...
This is the code in the master page:
$(document).ready(function() {
$.fn.dataTable.moment( 'DD/MM/YYYY');
$("#search").html($("#search").html().replace(//g, '''));
var dataTable = $('#<? echo $sezione; ?>-grid').DataTable( {
language: { search: "Cerca" ,
"info": "Comuni in elenco: _TOTAL_",
"sLengthMenu": "Mostra _MENU_ Comuni per pagina",
paginate: {
"next": "<i class='fas fa-arrow-alt-circle-right'></i>",
"previous": "<i class='fas fa-arrow-alt-circle-left'></i>",
}
},
"processing": true,
"serverSide": true,
"stateSave": false,
"searching": true,
"ajax":{
url :"<? echo $sezione; ?>-grid-data.php", // json datasource
type: "post", // method , by default get
error: function(){ // error handling
$(".<? echo $sezione; ?>-grid-error").html("");
$("#<? echo $sezione; ?>-grid").append('<tbody class="<? echo $sezione; ?>-grid-error"><tr><th colspan="3">Nessun dato presente.</th></tr></tbody>');
$("#<? echo $sezione; ?>-grid_processing").css("display","none");
}
}
} );
});
any help for me?
Thanks in advance
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hi,
Can you link to a page showing the issue please? We don't have any apostrophe in our default record set, but it does get sent to the server in this example.
Allan
Hi,
the page is:
https://angolocreativodesign.com/demo/demo.php
You can try to search item: D'Annunzio
and you will have no result but in the mysql database the record is in.
Any news on this?
Your page doesn't load - it gives a forbidden message.
Colin
no Colin, the link works... i can load
I get the same result as Colin.
sorry, fixed. Try now
This thread should help, it's asking the same thing.
Cheers,
Colin