Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save 90lteixeira/f0f4e29704f6753f622df2ba4fcdb1d4 to your computer and use it in GitHub Desktop.
Save 90lteixeira/f0f4e29704f6753f622df2ba4fcdb1d4 to your computer and use it in GitHub Desktop.
var nomeAlert = 'Medicamento';
x0p(nomeAlert, 'O medicamento "' + medicamento + '" foi aplicado?', 'warning');
$("#x0p-button-1").click(function () {
setTimeout(function() {
$.ajax({
type: 'POST',
url: 'Medicamentos/aplicarmedicamento',
data: {
codMedicamento : codVacina,
codCliente : codCliente,
valor : preco,
medicamento : medicamento,
nomeCachorro : cachorro
},
success: function (data) {
var dados = $.parseJSON(data);
x0p(nomeAlert, dados.msg, ((dados.status === 200 && dados.data) ? 'ok' : 'error'), false).then(function(data) {
window.location.reload();
});
},
error: function () {
x0p(nomeAlert, 'Não foi prosseguir, tente novamente.', 'error', false).then(function(data) {
window.location.reload();
});
}
});
}, 300);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment