WebForms Professional Edition license number is not valid for store domain.
require([ 'VladimirPopov_WebForms/js/form', 'jquery', 'VladimirPopov_WebForms/js/sweetalert', 'jquery/jquery.cookie' ], function (VarienForm, jQuery, swal) { jQuery(document).ready(function () { var blockId = 'webform_umoET6'; var jblockId = '#' + blockId; var webform_umoET6 = new VarienForm(blockId, 0); // Ajax submit jQuery('body').on('click', jblockId + ' .action.submit', function (e) { var form = webform_umoET6; if (typeof tinyMCE === 'object') tinyMCE.triggerSave(); if (!(form.validator && form.validator.validate())) { return; } var formData = new FormData(jQuery(jblockId)[0]); var self = this; e.preventDefault(); e.stopImmediatePropagation(); jQuery.ajax({ url: 'https://www.cokeshopth.com/webforms/form/submit/', data: formData, type: 'POST', cache: false, dataType: 'json', contentType: false, processData: false, beforeSend: function () { self.disable(); $(blockId + '_sending_data').show(); }, success: function (data, status, xhr) { if (data.success > 0) { if (data.script) { eval(data.script); return; } if (data.redirect_url) { $(blockId + '_progress_text').update('Redirecting'); // decode html entities window.location = jQuery('
').html(data.redirect_url).text(); return; } var successText = data.success_text; $(blockId + '_progress_text').update('สำเร็จ'); Effect.Fade(blockId + '_form', { duration: 0.5, from: 1, to: 0, afterFinish: function () { $(blockId + '_success_text').update(successText).show(); Effect.Fade(blockId + '_success_text', { duration: 0.5, from: 0, to: 1 }); if (0) Effect.ScrollTo(blockId + '_success_text', { duration: '0.1', offset: -window.innerHeight / 2 }); } }); } else { $(blockId + '_submit_button').enable(); if ($(blockId + '_sending_data')) $(blockId + '_sending_data').hide(); if ($(blockId + '_submit_button')) $(blockId + '_submit_button').enable(); var errorTxt = ''; if (data.errors && typeof (data.errors) == "string") { errorTxt = data.errors.unescapeHTML(); } else { errorTxt = 'Unknown error(s) occured'; } swal.fire({ title: 'ข้อผิดพลาด', html: errorTxt, type: 'error' }); if (data.script) { eval(data.script); } } }, error: function (xhr, status, errorThrown) { console.log('Error happens. Try again.'); console.log(errorThrown); } }); }); }); });