Hello, I'm a bit lay with scripts
yet. I ask for help, if at all possible.
I have the following script
:
$.ajax({
type: "POST",
url: "/PreVenda/GuardarPreVenda",
dataType: 'json',
data: JSON.stringify(json),
async: false,//this makes the ajax-call blocking
contentType: 'application/json;charset=UTF-8',
success: function (response) {
alert(response);
window.location.reload().ajax();
valid = response.valid;
},
error: function (error) {
alert(error);
}
});
});
I use window.location.reload().ajax();
to save when it clears all the fields on the screen, but when an error occurs on the page, it simply clears the fields too, I just want it to clear the fields, when everything is ok and not when give errors.
If someone can help me, thank you.