Search name with apostrophe inside mysql datatable.

Search name with apostrophe inside mysql datatable.

m75sam75sa Posts: 7Questions: 3Answers: 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:

Answers

  • allanallan Posts: 51,440Questions: 1Answers: 7,758 Site admin

    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

  • m75sam75sa Posts: 7Questions: 3Answers: 0
    edited February 21

    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.

  • m75sam75sa Posts: 7Questions: 3Answers: 0

    Any news on this?

  • colincolin Posts: 8,085Questions: 0Answers: 1,357

    Your page doesn't load - it gives a forbidden message.

    Colin

  • m75sam75sa Posts: 7Questions: 3Answers: 0
    edited February 24

    no Colin, the link works... i can load

  • tangerinetangerine Posts: 2,484Questions: 21Answers: 280
    Answer ✓

    I get the same result as Colin.

  • m75sam75sa Posts: 7Questions: 3Answers: 0

    sorry, fixed. Try now

  • colincolin Posts: 8,085Questions: 0Answers: 1,357
    Answer ✓

    This thread should help, it's asking the same thing.

    Cheers,

    Colin

Sign In or Register to comment.