Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form class="form-horizontal" id="notificaEvent" action="" method="post">
- <div class="form-group">
- <label class='col-sm-3 control-label' for='notificaTitle'>Titolo</label>
- <div class='col-sm-7'>
- <input id='notificaTitle' class='form-control' maxlength="50"
- placeholder=''/>
- </div>
- </div>
- <div class="form-group">
- <label class='col-sm-3 control-label' for='Type'>Type</label>
- <div class='col-sm-7'>
- <input type="radio" id="notificaType" name="type" value="important" checked="checked">Important
- <input type="radio" id="notificaType" name="type" value="notimportant"> Not Important<br>
- </div>
- </div>
- <div class="form-group">
- <label class='col-sm-3 control-label' id="notificaAttachment" for='Attachment'>Attachment</label>
- <div class='col-sm-7'>
- <input type="file" name="notificaFile" id="notificaFile">
- </div>
- </div>
- <div class="form-group">
- <label class='col-sm-3 control-label' for='notificaMsg'>Messaggio</label>
- <div class='col-sm-7'>
- <textarea id='notificaMsg' class='form-control' maxlength="300"
- placeholder=''></textarea>
- </div>
- </div>
- <div id="error-text" class="error-text form-group no-margin-side" style="display: none;">
- <span>* Tutti i campi sono obbligatori</span>
- </div>
- <div class="footer text-center">
- <input type='button' id='notifica_submit' class='btn btn-success send'
- data-loading-text='Sending notification...' value="INVIA"/>
- </div>
- </form>
- $(function () {
- validateNotifica();
- });
- });
- function validateNotifica() {
- desc = $("#notificaMsg").val();
- title = $("#notificaTitle").val();
- errorText = $("#error-text");
- if (desc === '' || title === '') {
- errorText.innerHTML = "* All fields are required.";
- errorText.addClass("red");
- errorText.show();
- return;
- }
- errorText.hide();
- errorText.removeClass("red");
- errorText.removeClass("green");
- $.ajax({
- dataType: 'json',
- type: 'POST',
- url: 'calendar/admin/php/notifica_events.php',
- data: {
- action: 'post',
- title: title,
- message: desc
- },
- success: function () {
- sendPushNotification(desc, title, function () {
- errorText.html("Notifica inviata con successo.");
- errorText.addClass("green");
- errorText.show();
- $('.other-quotes').empty();
- loadNotifications();
- });
- },
- error: function (data) {
- errorText.innerHTML = "* "+data.responseText;
- errorText.addClass("red");
- errorText.show();
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement