function validateEmail(email){ var regEx = /^[\w\.\+-]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,6}$/; if (!regEx.test(email)) { return false; } return true; } $(function() { $("#contactFormArea form").submit(function(e) { e.preventDefault(); var yname = document.getElementById('posName').value; var yidn = document.getElementById('posIdn').value; var yidu = document.getElementById('posIdu').value; var yemail = document.getElementById('posEmail').value; var yphone = document.getElementById('posPhone').value; var ycomment = document.getElementById('posText').value; var yhypo = $("#posHypo").is(":checked"); if((yname == '') || (yemail == '') || (yphone == '') || (ycomment == '')) { alert('Musíte správne vyplniť všetky položky'); return false; } if(validateEmail(yemail)){ var params = "feedback=1&nehnutelnostid=" + yidn + "&userid=" + yidu + "&name=" + yname + "&phone=" + yphone + "&email=" + yemail + "&comment=" + ycomment + "&hypo=" + yhypo; var url = encodeURI('ajax/feedback/contact.php?' + params); $.get(url, function(data) { $("#statusY").html(data); _gaq.push(["_trackEvent", "contact_form", "submited", "sent", 1]); }); SociomanticShowLead(); } else { alert('Nezadali ste správny Email'); return false; } }); });