How to avoid single and double quotes in DataTable

How to avoid single and double quotes in DataTable

VamshikrishnaVamshikrishna Posts: 1Questions: 0Answers: 0
edited August 2017 in Free community support

i am facing some issue because of single (') and double (") quotes in Jquery datatable if one of the field contain single (') and double (") it is throwing Expected ")" here is my Jquery datatable code

$('#searchcustomerData').DataTable(
                        {
                            "bServerSide" : false,
                            "oLanguage" : {
                                "sEmptyTable" : datatableMessage
                            },
                            "aaData" :values,
                            "aoColumns" : [ {
                                "mData" : "customerId" ,
                                className : "center"
                            }, {
                                "mData" : "cifNo",
                                className : "center"
                            }, {
                                "mData" : "groupId",
                                className : "center"
                            }, 
                            {
                                "mData" : "engFullName",
                                className : "center"
                            },  
                            {
                                "mData" : "thaiFullName",
                                className : "center"
                            },
                            {
                                "mData" : "priIdNumber",
                            }, 

                            {
                                "mData" : "guarantorFlag",
                                className : "center",
                            },

                            ],

can u please solve this

thanks in advance.

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Replies

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    what fields? Your data fields? There should be no issues unless your embedded strings are not properly escaped.

  • allanallan Posts: 63,478Questions: 1Answers: 10,467 Site admin

    There is no difference between single quotes and double quotes in Javascript (other than quoting as @bindrid says).

    Can you link to a page showing the issue please?

    Allan

This discussion has been closed.