FIX: que no aparezca el mensaje cuando funciona
This commit is contained in:
@ -219,6 +219,18 @@
|
|||||||
)
|
)
|
||||||
let data = new FormData(form[0])
|
let data = new FormData(form[0])
|
||||||
let url = '{{$urls->admin}}/evento/{{$evento->id}}/add'
|
let url = '{{$urls->admin}}/evento/{{$evento->id}}/add'
|
||||||
|
let fallo = () => {
|
||||||
|
$('#resultado').html('')
|
||||||
|
$('#resultado').append(
|
||||||
|
$('<div></div>').attr('class', 'ui negative message')
|
||||||
|
.append($('<i></i>').attr('class', 'inline close icon'))
|
||||||
|
.append('<p>No se pudo agregar.</p>')
|
||||||
|
)
|
||||||
|
$('#resultado .message .close').on('click', function() {
|
||||||
|
$(this).closest('.message')
|
||||||
|
.transition('fade');
|
||||||
|
});
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
data: data,
|
data: data,
|
||||||
@ -228,29 +240,12 @@
|
|||||||
success: (output) => {
|
success: (output) => {
|
||||||
if (output.estado) {
|
if (output.estado) {
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
$('#resultado').html('')
|
fallo()
|
||||||
$('#resultado').append(
|
|
||||||
$('<div></div>').attr('class', 'ui negative message')
|
|
||||||
.append($('<i></i>').attr('class', 'inline close icon'))
|
|
||||||
.append('<p>No se pudo agregar.</p>')
|
|
||||||
)
|
|
||||||
$('#resultado .message .close').on('click', function() {
|
|
||||||
$(this).closest('.message')
|
|
||||||
.transition('fade');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
error: () => {
|
error: () => {
|
||||||
$('#resultado').html('')
|
fallo()
|
||||||
$('#resultado').append(
|
|
||||||
$('<div></div>').attr('class', 'ui negative message')
|
|
||||||
.append($('<i></i>').attr('class', 'inline close icon'))
|
|
||||||
.append('<p>No se pudo agregar.</p>')
|
|
||||||
)
|
|
||||||
$('#resultado .message .close').on('click', function() {
|
|
||||||
$(this).closest('.message')
|
|
||||||
.transition('fade');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user