Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var add_smessage_form = document.getElementById("add_smessage_form");
- if (add_smessage_form != null) {
- $(add_smessage_form).submit(function () {
- var uri = '/support/addSupportMessage';
- var data = $(add_smessage_form).serialize();
- const cooki = cookie();
- document.cookie = 'CSRF-TOKEN=' + cooki;
- $.ajax({
- url: uri,
- data: data,
- timeout: 5000,
- crossDomain: true,
- headers: {'X-CSRF-TOKEN': cooki},
- xhrFields: {
- withCredentials: true
- },
- type: "POST",
- beforeSend: function () {
- NProgress.start();
- },
- complete: function () {
- NProgress.stop();
- }
- })
- .done(function(data) {
- switch(data.type) {
- case 'OK':
- setTimeout(function() {window.location = "/support";}, 5000);
- $('#add_support_messag_div').html('<div class="alert alert-success">' + data.message + '</div>');
- break;
- case 'ERROR':
- $('#add_support_message_div').html('<div class="alert alert-danger">' + data.message + '</div>');
- break;
- }
- });
- return false;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement