Answer the question
In order to leave comments, you need to log in
How to execute an ajax request once on page load?
The point is the following. There is an ajax request that hangs with the onClick event on the buttons. Ajax itself filters the elements on the page.
it looks like this
<?$varOnclick = "BX.ajax.insertToNode('$yearRequest', 'comp_".$arParams["AJAX_ID"]."'); return false;";?>
<div class="year-number <?if($arResult['FILTER_PARAMS']['YEAR'] == $arValue['ID']):?>activated<?endif;?>" id="year-<?=$arValue['ID']?>" onclick="<?=$varOnclick ?>"><?=$arValue['VALUE']?></div> // id у одной из кнопок будет year-30
checkFirstLoad = false;
if(!checkFirstLoad) {
oneClick();
}
function oneClick(){
$( "#year-30" ).click(); // имитируем нажатие кнопкой мишы на блок
checkFirstLoad = true;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question