Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. <form class="form-horizontal" id="notificaEvent" action="" method="post">
  2. <div class="form-group">
  3. <label class='col-sm-3 control-label' for='notificaTitle'>Titolo</label>
  4. <div class='col-sm-7'>
  5. <input id='notificaTitle' class='form-control' maxlength="50"
  6. placeholder=''/>
  7. </div>
  8. </div>
  9. <div class="form-group">
  10. <label class='col-sm-3 control-label' for='Type'>Type</label>
  11. <div class='col-sm-7'>
  12. <input type="radio" id="notificaType" name="type" value="important" checked="checked">Important
  13. <input type="radio" id="notificaType" name="type" value="notimportant"> Not Important<br>
  14. </div>
  15. </div>
  16. <div class="form-group">
  17. <label class='col-sm-3 control-label' id="notificaAttachment" for='Attachment'>Attachment</label>
  18. <div class='col-sm-7'>
  19. <input type="file" name="notificaFile" id="notificaFile">
  20.  
  21. </div>
  22. </div>
  23. <div class="form-group">
  24. <label class='col-sm-3 control-label' for='notificaMsg'>Messaggio</label>
  25. <div class='col-sm-7'>
  26. <textarea id='notificaMsg' class='form-control' maxlength="300"
  27. placeholder=''></textarea>
  28. </div>
  29. </div>
  30. <div id="error-text" class="error-text form-group no-margin-side" style="display: none;">
  31. <span>* Tutti i campi sono obbligatori</span>
  32. </div>
  33. <div class="footer text-center">
  34. <input type='button' id='notifica_submit' class='btn btn-success send'
  35. data-loading-text='Sending notification...' value="INVIA"/>
  36. </div>
  37. </form>
  38.  
  39. $(function () {
  40. validateNotifica();
  41. });
  42. });
  43.  
  44. function validateNotifica() {
  45. desc = $("#notificaMsg").val();
  46. title = $("#notificaTitle").val();
  47.  
  48. errorText = $("#error-text");
  49. if (desc === '' || title === '') {
  50. errorText.innerHTML = "* All fields are required.";
  51. errorText.addClass("red");
  52. errorText.show();
  53. return;
  54. }
  55. errorText.hide();
  56. errorText.removeClass("red");
  57. errorText.removeClass("green");
  58.  
  59. $.ajax({
  60. dataType: 'json',
  61. type: 'POST',
  62. url: 'calendar/admin/php/notifica_events.php',
  63. data: {
  64. action: 'post',
  65. title: title,
  66. message: desc
  67. },
  68. success: function () {
  69. sendPushNotification(desc, title, function () {
  70. errorText.html("Notifica inviata con successo.");
  71. errorText.addClass("green");
  72. errorText.show();
  73.  
  74. $('.other-quotes').empty();
  75. loadNotifications();
  76. });
  77. },
  78. error: function (data) {
  79. errorText.innerHTML = "* "+data.responseText;
  80. errorText.addClass("red");
  81. errorText.show();
  82. }
  83. });
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement