我试图用 JSON 响应动态创建一个 li,并在其中包含数据图标“检查”。但结果它总是显示“箭头-r”数据图标。
li 的生成:-
function CallvarURL(url) {
var respPrice ;
$.ajax({
url: url,
type : "GET",
dataType : "json",
contentType: "application/json",
async : false,
success : function(msg) {
respPrice = msg;
$("#varList li").remove();
$.each(respPrice.Value, function(index, value) {
if(value.SubVar_id == 'NoDataFound' ) {
alert('No product is assigned to '+ localStorage.getItem('userId') + ' for update the price please contact your admin.');
} else {
vari = value.SrNo;
commVari = value.subVar_eng_name;
minPrice = value.Frm_price;
maxPrice = value.to_price;
var update = value.TimeCheck;
if (update == 'Y') {
$respPrice = '<li data-categoryId = "'+ vari +'" data-categoryId2 = "'+ minPrice +'" data-categoryId3 = "'+ maxPrice +'" data-categoryId4 = "'+ commVari +'"><a href="#" data-icon="star"><b class="stuff">' + commVari + '</b><br><b class="tcolour">' + minPrice + ' - ' + maxPrice + '</b></a></li>';
} else {
$respPrice = '<li data-categoryId = "'+ vari +'" data-categoryId2 = "'+ minPrice +'" data-categoryId3 = "'+ maxPrice +'" data-categoryId4 = "'+ commVari +'"><b class="stuff">' + commVari + '</b><br><b class="tcolour">' + minPrice + ' - ' + maxPrice + '</b></li>';
}
$('#varList').append($respPrice);
};
});
找不到原因?我也尝试了数据图标的其他值,但它总是显示“箭头-r”。有什么帮助..??