I'm trying to send data from one form to another page, and bring a graphic of it in a div with id="return", which is below the form.
The form has the code, data1, data2, and store, but it appears that the variables are not being sent correctly.
I have done something similar but with only one variable, but with several not so.
My jQuery function is below, I believe you have something wrong with it.
I found several examples on the internet, but none helped me and solved my problem.
$(document).ready(function() {
//alert("teste 1 ");
/// Quando usuário clicar no botão será feito todos os passo abaixo
$('#formulario').submit(function() {
//alert("teste 2");
var codigo = $('#codigo').val();
var data1 = $('#data1').val();
var data2 = $('#data2').val();
var loja = $('#loja').val();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'retorna_produto.php',
async: true,
data: {codigo, data1, data2, loja},
//data: {'codigo='+ $('#codigo').val(),
// 'data1='+ $('#data1').val(),
// 'data2='+ $('#data2').val(),
// 'loja='+ $('#loja').val()
//},
success: function(data) {
$('#retorno').html(data);
}
});
return false;
});
});