我正在创建一个网页,因此我创建了两个复选框,一个对值进行排序,另一个过滤功能[它根据框中提供的规范获取值]。单独它工作正常,但当我尝试同时使用它们功能过滤器不起作用
编码:
var priceRangeFunction = function () {
$(".priceRange").on("click", function () {
countPrizeRange=countPrizeRange+1;
var priceSortFrom = $(this).attr("from");
var priceSortTo = $(this).attr("to");
conditions.push({
"range": {
"items.price": {
"gte": priceSortFrom,
"lte": priceSortTo
}
}
});
console.log(conditions);
search(0,conditions,featureConditions,customConditions);
});
};
var priceRangeCustomiseFunction = function () {
$(document).on('click', '#submitCustom', function (){
countPrizeRangeCheck=countPrizeRangeCheck+1;
var customPriceFrom = $("#custom").val();
var customPriceTo =$("#custom2").val();
customConditions.push({
"range": {
"items.price": {
"gte": customPriceFrom,
"lte": customPriceTo
}
}
});
console.log(conditions);
search(0,conditions,featureConditions,customConditions);
return false;
});
};
Dine-O var featuresFunction = function(){
$(".featuresList").on("click",function(){
countFeatureRange=countFeatureRange+1;
var featureName =[];
featureName.push($(this).attr("value"));
console.log("featureName" + featureName);
featureConditions.push({
"terms" :{
"items.hotelDetails.features": featureName,
"minimum_should_match" : 1
}
});
search(0,conditions,featureConditions,customConditions);
});
};