Skip to content

Instantly share code, notes, and snippets.

@irwingb1979
Created August 3, 2019 22:58
Show Gist options
  • Save irwingb1979/d26f3ae9708e53c3bd6ff28db0087ea0 to your computer and use it in GitHub Desktop.
Save irwingb1979/d26f3ae9708e53c3bd6ff28db0087ea0 to your computer and use it in GitHub Desktop.
//Se ejecuta cuando hay un archivo
$('#guardar-registro-archivo').on('submit', function(e) {
e.preventDefault();
var datos = new FormData(this);
// console.log(datos);
$.ajax({
type: $(this).attr('method'),
data: datos,
url: $(this).attr('action'),
dataType: 'json',
contentType: false,
processData: false,
async: true,
cache: false,
success: function(data) {
console.log(data);
var resultado = data;
if(resultado.respuesta == 'exito') {
swal(
'Good job!',
'You clicked the button!',
'success'
)
} else {
swal(
'Oops...',
'Something went wrong!',
'error'
)
}
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment