0
我從數據庫獲取動態數據並使用html()函數附加到我的html。 一切正常,但當動態數據包含'>'或'<'標籤作爲數據時,腳本將其作爲html標籤並且數據和腳本中斷。使用html加載動態數據()在加載的內容具有特殊字符時打破腳本
function showKeywordActivity(e, t, n, r, i) {
var s = $(e).find("input.keywordFrequencyIdList").val();
var o = $(e).find("input.keywordId").val();
var u = $(e).find(".keywordValue").val();
$(".hashKeyword").text("#" + u);
$("#tabs-1").html('<div class="innerBox"><div class="innerBoxcontent scroll"><div class="loadingWrap"><div class="loading"></div></div></div><div class="dashboardBottombox"></div></div>');
$.ajax({type: "POST",url: "url",data: {pageUrlHandle: n,keywordId: o,pattern: u,serviceType: t,startDate: r,endDate: i,keywordType: $("#keywordActivityTypeFilter").val(),keywordType: $("#activityFilter").val()},dataType: "html",async: true,success: function(t) {
$(e).css("background", "#F8FAFF");
$("#tabs-1").html(t);
$(".scroll").each(function() {
$(this).mCustomScrollbar({theme: "light",advanced: {updateOnBrowserResize: true,updateOnContentResize: true,autoExpandHorizontalScroll: false,autoScrollOnFocus: true}})
})
},error: function(e, t) {
}})
}
如何解決這個錯誤。任何人請幫助我