View file system/AJAX/dialog_modal.js

File size: 1.77Kb
$(document).on('click', '[id=dialog_modal_mess_open]', function() {
  
  var id_user = $(this).attr('user');
  var cntdlg = $(this).attr('count');
  
  $.ajax({
    
    url: '/system/AJAX/php/messages/dialog_modal_mess.php?id='+id_user+'&type='+cntdlg,
    type: "get",
    cache: false,
    beforeSend: function() {
      
      $('#dialog_modal_result').html('<font size="+2"><center style="margin-top: 200px"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i><br /></center></font>');
    
    },
    success: function(html){
      
      $('#dialog_modal_result').html(html);
      $(".content-mess-dialog").animate({scrollTop:999999999999999999},"slow");
    
    }
  
  });
  
});
  
$(document).on('click', 'button[id=dialog_modal_content_open]', function() {
  
  var cntdlg = $(this).attr('count');
  
  $.ajax({
    
    url: '/system/AJAX/php/messages/dialog_modal_contacts.php?type='+cntdlg,
    type: "get",
    cache: false,
    beforeSend: function() {
      
      $('#dialog_modal_result').html('<font size="+2"><center style="margin-top: 200px"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i><br /></center></font>');
    
    },
    success: function(html){
      
      $('#dialog_modal_result').html(html);
    
    }
  
  });
  
});

$(document).on('click', '.ajax-button-comments-dialog', function(e){
  
  var $that = $('.ajax-button-form-dialog');
  var link = $that.attr('action');
  $('.comments-button').html('<i class="fa fa-send fa-fw"></i>');
  
  $.post(
    
    link,    
    $that.serialize(),   
    
    function(data) {
      
      var elem = $(data).filter('#content-mess-dialog').html();
      $("#content-mess-dialog").html(elem); 
      $(".content-mess-dialog").animate({scrollTop:999999999999999999},"slow");
    
    }
  
  );
  
  e.preventDefault();
  
});