当我点击按钮时,ajax必须加载更多内容并将用户置于新的加载内容之上。功能在mozilla和IE中完美运行但不在Chrome中我不知道问题出在哪里。提前谢谢。
if ($showMoreOffersButton) { ?>
<div class="text-center box" id="show-more-tourism-offers-btn-holder">
<a class="site-button blue" onclick="showMoreTourismOffers(<?php echo $offset; ?>)"
onclick="ga('send', 'event', '<?= isset($parent_component) ? $parent_component : 'Unknown' ?>', 'Show More Offers' );">
<span class="glyphicon glyphicon-refresh spinning" id="travel-arrow-spinner"
style="display: none"></span>
ОЩЕ ОФЕРТИ
</a>
</div>
<? }
function showMoreTourismOffers(begin_offset) {
if (!btn_lock) {
//check if user already visited this page and saw more than 16 boxes
if (offset < begin_offset) {
offset = begin_offset;
}
var mobileFlag;
if(isMobile == 1){
mobileFlag = true;
}else{
mobileFlag = false;
}
$.ajax({
url: base_url + 'pochivki/show_more_offers/',
type: 'POST',
data: {
filter: ajaxDealFilter(true, mobileFlag),
country_index: countryIndex,
region_index: regionIndex,
city_index: cityIndex,
offset: offset,
current_url: window.location.href
},
success: function (data) {
$('#tourism-deals-holder').append(data.deals);
if (data.hideButton) {
$('#show-more-tourism-offers-btn-holder').remove();
}
offset += 48;
$('#travel-arrow-spinner').hide();
},
error: function () {
},
beforeSend: function () {
btn_lock = !btn_lock; // becomes true
$('#travel-arrow-spinner').show();
},
complete: function () {
btn_lock = !btn_lock; // becomes false again
$('.images-rotation').imagesRotation()
},
dataType: "json"
});
} }
答案 0 :(得分:-1)
解决这个问题我希望任何有同样问题的人帮助
if( sensorVal <= treshold ) {
Serial.println("Watering");
waterOn();
} else {
Serial.println("NOT watering");
waterOff();
}
}