Enviar 1 | Enviar 2 | Enviar 3
Abaixo o exemplo do arquivo em javascript:
// Código do primeiro link
$("#link1").click(function(){
$.ajax({
url : "cadastrar1.php",
type : 'post',
data : {
nome : "Maria Fernanda",
salario :'3500'
},
beforeSend: function() {
$("#resultadoOk").html("");
$("#resultadoOk").html("Enviando...");
},
success: function(response) {
$("#resultadoErro").html("");
$('#resultadoOk').html("OK");
},
error: function(xhr, status, error) {
$("#resultadoOk").html("");
$('#resultadoErro').html("Ocorreu um erro");
},
});
});
// Código do segundo link
$("#link2").click(function(){
$.ajax({
url : "cadastrar2.php",
type : 'post',
data : {
nome : "Maria Fernanda",
salario :'3500'
},
beforeSend: function() {
$("#resultadoOk").html("");
$("#resultadoOk").html("Enviando...");
},
success: function(response) {
$("#resultadoErro").html("");
$('#resultadoOk').html("OK");
},
error: function(xhr, status, error) {
$("#resultadoOk").html("");
$('#resultadoErro').html("Ocorreu um erro");
},
});
});
// Código do terceiro link
$("#link3").click(function(){
$.ajax({
url : "cadastrar3.php",
type : 'post',
data : {
nome : "Maria Fernanda",
salario :'3500'
},
beforeSend: function() {
$("#resultadoOk").html("");
$("#resultadoOk").html("Enviando...");
},
success: function(response) {
$("#resultadoErro").html("");
$('#resultadoOk').html("OK");
},
error: function(xhr, status, error) {
$("#resultadoOk").html("");
$('#resultadoErro').html("Ocorreu um erro");
},
});
});