[英]String with quotation marks from SpringMVC controller, not shown with javascript-jquery
我嘗試顯示從Spring MVC控制器發送的jquery數據。 問題是字符串在數據庫中帶有引號,因此,我的JavaScript代碼-jquery無法正常工作。
例如,我的字符串是數據庫中的(主要:“ Carl Duvierts”),由控制器發送。
alert("${person.name}"); //not working
如果您正在使用的對象已經是字符串,則警報中不需要在其周圍加上引號。
//this will work
var stringWithQuotes = 'abc"de"fg';
alert(stringWithQuotes);//no quotation marks inside the parentheses
//The code you provided:
alert("${person.name}");
//will just alert the actual string '${person.name}', not what is referenced by the variable
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.