I have the following scripts, one for validation and one for sending to php:
$(document).ready(function(){
$("input,textarea").blur(function(){
if($(this).val() == "")
{
$(this).css({"border" : "1px solid #F00", "padding": "2px"});
}
});
$("#butEnviar").click(function(){
var cont = 0;
$("#form input,textarea").each(function(){
if($(this).val() == "")
{
$(this).css({"border" : "1px solid #F00", "padding": "2px"});
cont++;
}
});
if(cont == 0)
{
$("#form").submit();
}
});
});
This is for validation
$(document).ready(function() {
$("#butEnviar").click(function() {
var nome = $("input[name=nome]").val();
var email = $("input[name=email]").val();
var telefone = $("input[name=telefone]").val();
var assunto = $("input[name=assunto]").val();
var msg = $("textarea[name=msg]").val();
$.ajax({
"url": "enviar.php",
"dataType": "html",
"data": {
"nome" : nome,
"email":email ,
"telefone": telefone,
"assunto": assunto,
"msg" : msg
},
"success": function(response) {
$("div#saida").html(response);
$("#reset").click();
}
And this one for shipping. But I think this is conflicting and you are not sending the data to enviar.php
, what should I do?