Пример из файла /bitrix/modules/search/admin/search_reindex.php
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_REQUEST["Reindex"] == "Y") {
@set_time_limit(0);
$res = CSearch::ReIndexAll(
$bFull, COption::GetOptionInt("search", "max_execution_time"), $NS, $_REQUEST["clear_suggest"] === "Y"
);
if (is_array($res)):
?>
<script>
CloseWaitWindow();
DoNext(<?echo $jsNS?>);
</script>
<?php
else:
?>
<script>
CloseWaitWindow();
EndReindex();
var search_message = BX('search_message');
if (search_message)
search_message.style.display = 'none';
</script>
<?php
endif;
}
function DoNext(NS) {
var queryString = 'Reindex=Y'
+ '&lang=<?echo htmlspecialcharsbx(LANG)?>';
...
ShowWaitWindow();
BX.ajax.post(
'search_reindex.php?' + queryString,
NS,
function (result) {
document.getElementById('reindex_result_div').innerHTML = result;
var href = document.getElementById('continue_href');
if (!href) {
CloseWaitWindow();
StopReindex();
}
}
);
return false;
}