<? foreach ($arResult["ITEMS"] as $arItem):?>
<a class="up-your-ads-icon" href="#" id="go" onclick="
<?
$newEl = new CIBlockElement;
$elProps
= array(
"MODIFIED_BY" => $USER->GetID(),
"IBLOCK_ID" => 3,
"ACTIVE_FROM" => ConvertTimeStamp(time(), "FULL"),
"ACTIVE" => "Y",
);
$res = $newEl->Update($arItem['ID'], $elProps);
?> "><?=$arItem['ID']?></a>
<? endforeach ?>
<a class="update" data-id='<?=$arItem['ID']?>' href="">Ссылка примерного вида</a>
$(".update").click(function(event) {
var id = $(this).attr('data-id');
$.ajax({
url: '/path/to/file',
type: 'post',
data: {id: id},
})
.done(function() {
console.log("success");
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
});
<?
include($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
if(\Bitrix\Main\Loader::includeModule('iblock')) {
$newEl = new CIBlockElement;
$elProps = array(
"MODIFIED_BY" => $USER->GetID(),
"IBLOCK_ID" => 3,
"ACTIVE_FROM" => ConvertTimeStamp(time(), "FULL"),
"ACTIVE" => "Y",
);
$res = $newEl->Update($_REQUEST["id"], $elProps);
}
$("#go a").click(updateElement)
function updateElement()
{
$.ajax({
url: "/local/ajax/edit-ads2.php",
type: "POST",
data: requestData,
cache: false,
dataType: 'html',
processData: false,
contentType: false,
success: function (data) {
$('.my-ads-list-container .ads-date').html(data)
$('#go').show;
},
error: function (error) {
console.log('error', error);
}
});
}
<?
include($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
$newEl = new CIBlockElement;
$elProps
= array(
"MODIFIED_BY" => $USER->GetID(),
"IBLOCK_ID" => 3,
"ACTIVE_FROM" => ConvertTimeStamp(time(), "FULL"),
"ACTIVE" => "Y",
);
$res = $newEl->Update($arItem['ID'], $elProps);
foreach( $arResul['ITEMS'] as $arItem)
{
?><a class="update" data-id='<?=$arItem['ID']?>' href="">Ссылка примерного вида</a><?
}