Trigub_Ilia

Открытие попап окна средствами битрикс

Jan 10th, 2018
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Вешается на событие click
  2. var popup = new BX.PopupWindow('popup-rejection', null, {
  3.             lightShadow: true,
  4.             content: '<div style="font-size: 14px; margin-top:10px;">Причина отказа</div>',
  5.             closeIcon: {right: "20px", top: "10px"},
  6.             titleBar: 'Причина отказа',
  7.             zIndex: 0,
  8.             offsetLeft: 0,
  9.             offsetTop: 0,
  10.             draggable: {restrict: true},
  11.             buttons: [
  12.                 new BX.PopupWindowButton({
  13.                     text: "Установить",
  14.                     className: "popup-window-button-accept",
  15.                     events: {
  16.                         click: function () {
  17.                             var _this = this.popupWindow;
  18.                             BX.ajax.submit(BX("form_rejection"), function(data){
  19.                                 var dataJson = $.parseJSON(data);
  20.                                 _this.close();
  21.  
  22.                                 var id = location.pathname.match(/\d+/)[0];
  23.                                 $.post('/local/ajax/lead/junk.php', {LEAD_ID: id, REJECTION: dataJson.ENUM_ID}, function (data) {
  24.                                     location.reload(true);
  25.                                 });
  26.  
  27.                             });
  28.  
  29.  
  30.                         }
  31.                     }
  32.                 }),
  33.                 new BX.PopupWindowButton({
  34.                     text: "Отмена",
  35.                     className: "webform-button-link-cancel",
  36.                     events: {
  37.                         click: function () {
  38.                             this.popupWindow.close();
  39.                         }
  40.                     }
  41.                 })
  42.             ]
  43.         });
  44.  
  45. BX.showWait();
  46. //Подгрузка контента страницы
  47.             BX.ajax({
  48.                 url: '/local/ajax/lead/change_rejection_junk.php',
  49.                 method: 'POST',
  50.                 data: {},
  51.                 dataType: 'html',
  52.                 processData: true,
  53.                 scriptsRunFirst: true,
  54.                 emulateOnload: true,
  55.                 start: true,
  56.                 cache: false,
  57.                 onsuccess: function(data){
  58.                     popup.setContent(data);
  59.                     popup.show();
  60.                     BX.closeWait();
  61.                 }
  62.             });
  63.  
  64.  
  65. //php файл
  66. <?
  67. require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
  68. ?>
  69. <div class="personal-desktop popup">
  70.     <form action="/local/ajax/lead/change_rejection_junk.php" name="form_rejection" id="form_rejection" method="POST">
  71.    
  72.     </form>
  73. </div>
Add Comment
Please, Sign In to add comment