remove double quotes from Json return data using Jquery

前端 未结 8 2118
半阙折子戏
半阙折子戏 2020-12-08 06:29

I use JQuery to get Json data, but the data it display has double quotes. It there a function to remove it?

$(\'div#ListingData\').text(JSON.stringify(data.         


        
8条回答
  •  北荒
    北荒 (楼主)
    2020-12-08 07:24

    Use replace:

    var test = "\"House\"";
    console.log(test);
    console.log(test.replace(/\"/g, ""));  
    
    // "House"
    // House
    

    Note the g on the end means "global" (replace all).

提交回复
热议问题