Správce webových stránek

[ jQuery(document).ready(function($) { jQuery("#preloader-lvykmh").fadeOut(500, function() { jQuery("#ecf-form-lvykmh").fadeIn(300); }); Ladda.bind('.ladda-button'); $(function() { /* Validation */ $("#form-lvykmh").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-lvykmh')); }, 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'] = '6613'; data['security'] = '43b9b3d6b6'; 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-lvykmh").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-lvykmh").get(0).reset(); notifyme(data.msg, 'n', 'error', 'left middle'); } Ladda.stopAll(); } }); } /* Notify */ function notifyme(msg, b, typ, pos) { if (b == 'n') { b = 'cf-submittedlvykmh'; } else { b = 'atclvykmh'; } $("#" + b).gnotify(msg, { style: "nbootstrap", elementPosition: pos, className: typ }); msg = null; typ = null; } });