Skip to content

Instantly share code, notes, and snippets.

@steepzero-old
Created October 27, 2017 11:24
Show Gist options
  • Save steepzero-old/44f15e529457356504f925b705754c41 to your computer and use it in GitHub Desktop.
Save steepzero-old/44f15e529457356504f925b705754c41 to your computer and use it in GitHub Desktop.
$request
<?require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php');
use \Bitrix\Main\Loader;
use \Bitrix\Main\Web\Json;
use \Bitrix\Main\Application;
use \F5Studio\Application\Application as App;
$request = Application::getInstance()->getContext()->getRequest();
if($request->isAjaxRequest() && check_bitrix_sessid()){
if($request->getPost('ID')){
Loader::includeModule('iblock');
try {
App::cancel($request->getPost('ID'));
echo Json::encode(array(
'status' => true,
));
}catch (\Exception $e){
echo Json::encode(array(
'status' => false,
'message' => $e->getMessage()
));
}
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment