<script type="text/javascript">
var id=null;
  function getchatbyid(elem,title,description){

   $("#complaint_title").html(title);
   $("#complaint_description").html(description);

    id = elem.id;

    var url = "{{url('getsupportcomments')}}/"+id;

     $.get(url, function(data, status){


      $("#comments").html('');

     $("#comments").html(data);


    });
  }

    function postchatbyid(elem){   
      

    var comment=$('#client_comment').val();
 var url = "{{url('supportcomment')}}/"+id+'/'+comment;

     $.get(url,function(data, status){

      $("#client_comment").val('');
      $("#comments").html('');

     $("#comments").html(data);


    });
  }
  var gethtml=null;
$(document).ready(function(){
  gethtml = $('.checkchat').html();

 $('.checkchat').empty();
});

function checkChat(elem,countid){

   var id=elem.id;
   var url = "{{url('getsupportcomments')}}/"+id;

     $.get(url, function(data, status){


      if(data.length < 2){
        $("#"+countid).html(gethtml);
      }


    });
 
}

</script>
