Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. $('body').on('click', 'button#do_comment', function(event) {
  2. event.preventDefault();
  3. var msg = $("textarea#msg").val();
  4. var totalComments=$("input#totalComments").val();
  5. if (msg.replace(/ /g, '').length > 1) {
  6. $("textarea#msg").popover('hide');
  7. $("#for_msg").removeClass('has-error');
  8.  
  9. $.ajax({
  10. type: "POST",
  11. url: "{{URL::to('/ticket/comment'.'/'.$ticket->code)}}",
  12. dataType: "json",
  13. data: {
  14. _token : CSRF_TOKEN,
  15. _method: 'PATCH',
  16. msg: msg,
  17. visible_client: $("#visible_client").prop( "checked"),
  18. totalComments: totalComments,
  19. fileIDS: ids
  20. },
  21. success: function(html) {
  22. if ($("#noComments").length) {
  23. $("#noComments").hide();
  24. }
  25.  
  26. $("textarea#msg").val('');
  27. $('textarea#msg').trumbowyg('empty');
  28. autosize.update($('textarea'));
  29. $.each(html, function(i, item) {
  30. $('#content_chat').append(item.html);
  31. $("#totalComments").val(item.total);
  32.  
  33. });
  34.  
  35. $("#previews").html('');
  36. ids = [];
  37.  
  38. }
  39. });
  40. }
  41. else {
  42. $("textarea#msg").popover('show');
  43. $("#for_msg").addClass('has-error');
  44. setTimeout(function() {
  45. $("textarea#msg").popover('hide');
  46. }, 2000);
  47. }
  48.  
  49. }
  50. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement