Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('body').on('click', 'button#do_comment', function(event) {
- event.preventDefault();
- var msg = $("textarea#msg").val();
- var totalComments=$("input#totalComments").val();
- if (msg.replace(/ /g, '').length > 1) {
- $("textarea#msg").popover('hide');
- $("#for_msg").removeClass('has-error');
- $.ajax({
- type: "POST",
- url: "{{URL::to('/ticket/comment'.'/'.$ticket->code)}}",
- dataType: "json",
- data: {
- _token : CSRF_TOKEN,
- _method: 'PATCH',
- msg: msg,
- visible_client: $("#visible_client").prop( "checked"),
- totalComments: totalComments,
- fileIDS: ids
- },
- success: function(html) {
- if ($("#noComments").length) {
- $("#noComments").hide();
- }
- $("textarea#msg").val('');
- $('textarea#msg').trumbowyg('empty');
- autosize.update($('textarea'));
- $.each(html, function(i, item) {
- $('#content_chat').append(item.html);
- $("#totalComments").val(item.total);
- });
- $("#previews").html('');
- ids = [];
- }
- });
- }
- else {
- $("textarea#msg").popover('show');
- $("#for_msg").addClass('has-error');
- setTimeout(function() {
- $("textarea#msg").popover('hide');
- }, 2000);
- }
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement