I started studying JavaScript and JQuery. I was doing a test to display on the screen what was sent via Form, but you are only sending value from a field, could anyone help me?!
Here is the HTML with the script:
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<form name="frm" id="frm" method="POST" action="">
<input type="text" name="nome" id="nome" value="" />
<input type="text" name="sobrenome" id="sobrenome" value="" />
<input type="submit" name="enviar" id="enviar" value="Enviar" />
</form>
<div id="exibir_valor"></div>
<script>
$("#enviar").click(function(e) {
e.preventDefault();
var valor = $("#frm").serialize();
$.ajax({
action: $(this),
type:'POST',
data: valor,
url:'insert.php',
success:function(data) {
$( "#exibir_valor" ).html(data);
}
});
});
</script>
and here is the php just to test (insert.php):
<?php
var_dump($name = $_POST['nome']);
$last_name = $_POST['sobrenome'];
Thank you in advance!