I have a two-page form and I want to use the jQuery button event on page 1 on page 2, to display a jQuery message:
Page 1 index
<form method="post" action="Guardar.html">
<input type="submit" name="boton" id="boton"/>
</form>
Page 2 Save.html
<link href="https://cdn.jsdelivr.net/sweetalert2/6.0.1/sweetalert2.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/sweetalert2/6.0.1/sweetalert2.min.js"></script>
<script>
$("#boton").submit()("click",function(){
swal({
title: 'Alerta con cierre automatico!',
text: 'Esta alerta se cerrara en 2 segundos.',
timer: 2000
}).then(
function () { },// handling the promise rejection
function (dismiss) {
if (dismiss === 'timer') {
console.log('La alerta fue cerrada en 2 segundos')
location.href = 'index.html';
}
}
)
})
</script>
I want to call the button on my form to that page with jQuery to make it work