form with ajax
-
Good afternoon everyone. I have a problem. I can not make a form with ajax inside of wordpress . I’m doing within a page template . Funny that out of wordpress works okay, but when I go put on my wordpress site does not. Someone can give a help there ? Thanks guys .
My code is this
<script>
$(function(){
$(‘.form’).submit(function(){var nome = $(“.nome”).val();
var sobrenome = $(“.sobrenome”).val();$.ajax({
url: ‘envia.php’,
type: ‘POST’,
data: $(‘.form’).serialize(),
success: function(data) {
if (data != ” ){
$(‘.recebeDados’).html(data);
} else {
alert(‘Existem campos em branco!’);
}
}
});
return false;
});});
</script>
- The topic ‘form with ajax’ is closed to new replies.