1
{
"hotel_id": 1,
"costs": 3651.78,
"clicks": 139
},
{
"hotel_id": 2,
"costs": 2894.62,
"clicks": 135
},
{
"hotel_id": 3,
"costs": 4529.45,
"clicks": 126
},
{
"hotel_id": 4,
"costs": 3323.65,
"clicks": 140
},
{
"hotel_id": 5,
"costs": 4839.67,
"clicks": 135
},
{
"hotel_id": 6,
"costs": 4701.21,
"clicks": 135
},
{
"hotel_id": 7,
"costs": 3444.94,
"clicks": 144
},
{
"hotel_id": 8,
"costs": 5067.62,
"clicks": 132
},
{
"hotel_id": 9,
"costs": 2256.84,
"clicks": 118
},
{
"hotel_id": 36,
"costs": 3475.65,
"clicks": 123
}
$.ajax({
url:"${contextPath}/hotel/get-hotel-info-byDate-ajax.html",
cache: false,
type : "POST",
data:{"hotelIdArray[]":hotelIdArray},
success:function(data) {
var flag = "${SESSION_KEY_ACCOUNT_CURRENCY_SUFFIX}";
for(var i=0;i< hotelIdArray.length;i++){//不存在的初始化为0
var t_hotel = hotelIdArray[i];
$('#costNum_'+t_hotel).html(flag+'0');
$('#clickNum_'+t_hotel).html(0);
}
for(var i=0;i< data.length;i++){
var tmpId = data[i].hotel_id;
var tmpCost = data[i].costs;
var tmpClick = data[i].clicks;
var costNum = "costNum_"+tmpId;
var clickNum = "clickNum_"+tmpId;
if(tmpCost==undefined||tmpCost==null) tmpCost = 0;
if(tmpClick==undefined||tmpClick==null) tmpClick = 0;
var cost = formatCurrencyWithDecimal(tmpCost, flag, 0)
$('#'+costNum).html(cost);
$('#'+clickNum).html(tmpClick);
}
},
error: function(data) {
// alert("error");
}
});
}