[英]jstl c:set is not working on js code in jsp file
I have a JSON from a service. 我有来自服务的JSON。 I am appending a html block by JSON value and I have to check some values for appropriate display.
我要按JSON值附加html块,并且必须检查一些值以进行适当的显示。 I am trying to set discountValue variable but it not working with js variable.
我正在尝试设置DiscountValue变量,但不能与js变量一起使用。 How can I solve it?
我该如何解决?
if (data!="")
{
$.each(data,function(index,element){
var intDiscount=parseInt(10);
console.log("intDiscount::"+intDiscount);
var strIndex='';
strIndex+='<div class="card">';
strIndex+='<c:set var="discountValue" value="'+intDiscount+'"/>';
console.log("${discountValue}");
...
...
...
...
}
$('#visilabs-FavouriteCategoryTopSeller').append(strIndex);
Console log: 控制台日志:
intDiscount::10
0
I have solved it with using if condition with js: 我已经通过使用if条件与js解决了它:
if(element.discount>0){
strIndex+= ' <span class="label label-danger discount">'+'% '+intDiscount+'</span>';
}
Thanks everyone 感谢大家
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.