-2
I’m trying to do a function in jQuery that by clicking on button he executed the function click() jQuery to take input data and send via post.
HTML
<input type="text" name="nome" class="input-xlarge" placeholder="Nome" required="required" />
<input type="email" name="email" class="input-xlarge" placeholder="Endereço de email" required="required" />
<input type="text" name="dominio" class="input-xlarge" placeholder="Domínio" required="required" />
<button type="submit" class="btn submit" id="submit">Criar uma conta</button>
jQuery
<script>
$(document).ready(function()
{
$("#submit").click(function()
{
var nome = $("input[name=nome]").val();
var email = $("input[name=email]").val();
var dominio = $("input[name=dominio]").val();
$.post('api.php', {nome:nome, email:email}, function(data)
{
alert(data);
})
})
})
</script>
In the browser console an error appears:
Uncaught Referenceerror: Datex is not defined preco.php:29 (Anonymous Function) preco.php:29 (Anonymous Function) preco.php:30 Uncaught Referenceerror: _gaq is not defined global.js:1 (Anonymous Function) global.js:1 o jquery.min.js:2 p.fireWith jquery.min.js:2 e.extend.ready jquery.min.js:2 c.addEventListener.B
It doesn’t return anything to me. I click the button and nothing happens. It doesn’t even show Alert()
– Alisson Acioli
Has a
<form>
around those fields or not? If so, include the code in the question.– bfavaretto
Has no <form>.
– Alisson Acioli
The error seems in php now :(
– user6026
To clarify why I closed this question: the author commented in the answer below that there was a problem in the upload order of the js files. I considered it unlikely that another person would have the same problem with the same symptom (the above error).
– bfavaretto