<?php
$arUrlRewrite=array (
3 =>
array (
'CONDITION' => '#^/about/([0-9a-zA-Z_-]+)/.*#',
'RULE' => 'ELEMENT_CODE=$1',
'ID' => 'site:news',
'PATH' => '/about/detail.php',
'SORT' => 100,
),
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Title");?>
<?$APPLICATION->IncludeComponent(
"site:news.detail",
"decision",
Array(
"ACTIVE_DATE_FORMAT" => "d.m.Y",
"ADD_ELEMENT_CHAIN" => "N",
"ADD_SECTIONS_CHAIN" => "Y",
"AJAX_MODE" => "N",
"AJAX_OPTION_ADDITIONAL" => "",
"AJAX_OPTION_HISTORY" => "N",
"AJAX_OPTION_JUMP" => "N",
"AJAX_OPTION_STYLE" => "Y",
"BROWSER_TITLE" => "-",
"CACHE_GROUPS" => "Y",
"CACHE_TIME" => "36000000",
"CACHE_TYPE" => "A",
"CHECK_DATES" => "Y",
"DETAIL_URL" => "",
"DISPLAY_BOTTOM_PAGER" => "Y",
"DISPLAY_DATE" => "Y",
"DISPLAY_NAME" => "Y",
"DISPLAY_PICTURE" => "Y",
"DISPLAY_PREVIEW_TEXT" => "Y",
"DISPLAY_TOP_PAGER" => "N",
"ELEMENT_CODE" => $_REQUEST["ELEMENT_CODE"], // данный параметр тебе передаст urlrewrite
"ELEMENT_ID" => "",
"FIELD_CODE" => array("",""),
"IBLOCK_ID" => "13",
"IBLOCK_TYPE" => "content",
"IBLOCK_URL" => "",
"INCLUDE_IBLOCK_INTO_CHAIN" => "Y",
"MESSAGE_404" => "",
"META_DESCRIPTION" => "-",
"META_KEYWORDS" => "-",
"PAGER_BASE_LINK_ENABLE" => "N",
"PAGER_SHOW_ALL" => "N",
"PAGER_TEMPLATE" => ".default",
"PAGER_TITLE" => "Страница",
"PROPERTY_CODE" => array("",""),
"SET_BROWSER_TITLE" => "Y",
"SET_CANONICAL_URL" => "N",
"SET_LAST_MODIFIED" => "N",
"SET_META_DESCRIPTION" => "Y",
"SET_META_KEYWORDS" => "Y",
"SET_STATUS_404" => "N",
"SET_TITLE" => "Y",
"SHOW_404" => "N",
"STRICT_SECTION_CHECK" => "N",
"USE_PERMISSIONS" => "N",
"USE_SHARE" => "N"
)
);?><?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>
$('.post-like').click(async function(){
var response = await $.ajax({
url: '/ajax/post_like.php',
type: 'POST',
dataType: 'json',
data: {
action: 'check',
post_id: $(this).parents('.item').attr('id')
}
});
if (response.already_vote == 1) {
alert('Еденица!');
} else {
alert('Не еденица!');
}
});
function already_vote(post_id, callback){
$.ajax({ <options> })
.done(function(response){
if(response.already_vote == 1){
return callback(true);
}
return callback(false);
})
.fail(function(xhr){
console.log(xhr);
});
}
$('.post-like').click(function(){
const item_id = $(this).parents('.item').attr('id');
already_vote(item_id, function(isVoted) {
if(isVoted){
//...
}
else {
//...
}
});
});
function already_vote(post_id, callback){
return new Promise(res => {
$.ajax({ <options> })
.done(function(response){
if(response.already_vote == 1){
return res(true);
}
return res(false);
})
});
}
$('.post-like').click(async function(){
const item_id = $(this).parents('.item').attr('id');
const isVoted = await already_vote(item_id);
if(isVoted){
//...
}
else {
//...
}
});
<span class="addField add">
<i class="icon"></i>Добавить
</span>
<div class="inputs">
<div>
<input type="file" name="dynamic[]" class="field" >
<span class="remove">Удалить</span>
</div>
</div>
$(document).ready(function () {
$('html').on('click','.add',function () {
$('<div><input type="file" class="field" name="dynamic[]" /><span class="remove">Удалить</span></div> ').fadeIn('slow').appendTo('.inputs');
});
$('html').on('click','.remove', function () {
$(this).parent().remove();
});
});