Advertisement
Guest User

js fix

a guest
Oct 25th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).on('click', '.move-to__item', function() {
  2.     var $this = $(this),
  3.         $list = $this.parent('ul'),
  4.         $order = $this.parents('.advertisement'),
  5.         data = $.extend($this.data(), $order.data()),
  6.  
  7.         url = '/move2/';
  8.  
  9.     $list.hide();
  10.  
  11.     mscConfirm("Вы подтверждаете действие?", "", function () {
  12.         $.ajax({
  13.             url: url,
  14.             data: data,
  15.             method: 'POST',
  16.             success: function() {
  17.                 $list.empty();
  18.  
  19.                 $.each(statuses, function(statusId, statusText) {
  20.                     if (+statusId !== data.status) {
  21.                         $list.append($('<li data-status="' + statusId + '" data-id="' + data.id + '" class="move-to__item"> \
  22.                            <a href="#">' + statusText + '</a> \
  23.                        </li>'));
  24.                     }
  25.                 });
  26.  
  27.                 $('.advertisement-list')
  28.                     .eq(data.status - 1)
  29.                     .find('> ul')
  30.                     .eq(+($order.data('type') !== 'order'))
  31.                     .append($order);
  32.             },
  33.             error: function(d) {
  34.                 console.log(d);
  35.             }
  36.         });
  37.     });
  38. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement