Показать сообщение отдельно
  #4 (permalink)  
Старый 13.10.2016, 08:35
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,080

nick032,
вариант...
$(function() {
$('#favorites-del-all').click(function(e){
    //e.preventDefault();
    //if( !confirm("Подтвердите удаление") ) return;

    var $this = $(this),
      parent = $this.parent(),
      loader = $this.next(),
      list = parent.prev().hide();

    $.ajax({
      type: 'POST',
      url: ajaxurl,
      data: {
        security: Favorites.nonce,
        action: 'favorites_dell_all',
      },
      beforeSend: function(){
        $this.fadeOut(300);
        loader.fadeIn(300);
      },
      success: function(res){
        loader.stop().fadeOut(300, function(){
          list.html(res).show();
        });
      },
      error: function(){
        alert('Ошибка');
      }
    });
  });

});
Ответить с цитированием