From 87b38e1cb5d5d5ebddfa4601a9088c3eadaf7ef0 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 31 Jul 2016 23:39:22 +0200 Subject: Easier emails --- js/businessadmin.js | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/businessadmin.js b/js/businessadmin.js index e5da52e..1d00fa9 100644 --- a/js/businessadmin.js +++ b/js/businessadmin.js @@ -108,9 +108,6 @@ $(document).ready(function(){ method: 'GET', crossDomain: true, cache: false, - xhrFields: { - withCredentials: true - }, data: { setting: collapsed } @@ -119,3 +116,50 @@ $(document).ready(function(){ return true; }); }); + +// Email modal +function sendMail() { + var modal = $('#modal-email'); + var modalBody = modal.find('.modal-body'); + var sendIcon = modal.find('.modal-footer .btn-send .fa'); + var values = modalBody.find('form').serialize(); + modalBody.find(':input').prop('disabled', true); + sendIcon.removeClass('fa-envelope').addClass('fa-spin fa-refresh'); + $.ajax({ + url: const_url_external + 'ajax/email/offer', + method: 'POST', + data: values, + success: function(data) { + modal.modal('hide'); + modalBody.html(''); + }, + error: function(jqxhr, stat, err) { + modalBody.find('.alert').remove(); + modalBody.html('