Email obecního úřadu v Nepomuku

jQuery(document).ready(function($) { jQuery("#preloader-lfzxpe").fadeOut(500, function() { jQuery("#ecf-form-lfzxpe").fadeIn(300); }); Ladda.bind('.ladda-button'); $(function() { /* Validation */ $("#form-lfzxpe").validate({ /* Rules for form validation */ rules: { name0:{required: true},email1:{required: true,email: true},text2:{required: true},message3:{required: true,minlength: 10}, }, /* Messages for form validation */ messages: { name0:{required: "Toto pole je povinné"},email1:{required: "Toto pole je povinné"},text2:{required: "Toto pole je povinné"},message3:{required: "Toto pole je povinné"} }, /* Do not change code below */ errorPlacement: function(error, element) { error.insertAfter(element.parent()); }, submitHandler: function(form) { ecf_onsubmit(jQuery('.form-lfzxpe')); }, invalidHandler: function(form) { Ladda.stopAll(); }, onkeyup: false, onfocusout: false, onclick: false }); }); /* Form Submit ( Ajax ) */ function ecf_onsubmit(form) { if (form.attr('action') == '#') { data = {}; eldat = []; data['action'] = 'ecf_deliver_mail'; data['formid'] = '6584'; data['security'] = '52a447aa46'; jQuery('input, textarea', form).each(function(key) { items = {}; if (typeof $(this).data('type') === 'undefined') { return true; } items['type'] = $(this).data('type'); items['label'] = $(this).data('label'); items['value'] = this.value; items['name'] = this.name; eldat.push(items); }); data['allelmnt'] = JSON.stringify(eldat); submitForm(); return false; } } /* Start submitForm */ function submitForm() { jQuery.ajax({ url: 'https://nepomuk-pb.cz/wp-admin/admin-ajax.php', type: 'POST', dataType: 'json', data: data, success: function(data) { if (data.Ok == true) { $("#form-lfzxpe").get(0).reset(); if (data.msg == 'redirect') { window.location = "http://"; } else { notifyme('Vaše zpráva byla úspěšně odeslána', 'n', 'success', 'left middle'); } } else { $("#form-lfzxpe").get(0).reset(); notifyme(data.msg, 'n', 'error', 'left middle'); } Ladda.stopAll(); } }); } /* Notify */ function notifyme(msg, b, typ, pos) { if (b == 'n') { b = 'cf-submittedlfzxpe'; } else { b = 'atclfzxpe'; } $("#" + b).gnotify(msg, { style: "nbootstrap", elementPosition: pos, className: typ }); msg = null; typ = null; } });