I've been using the following snippet on my ajax form submits:
$.ajax({
url: "",
data: ilmoittautumisdata,
type: "POST",
success:function(){
});
error:function(){
});
});
However, I remember that I was told to stop using success and error within it, as they're deprecated (?) and instead use $.ajaxComplete();
and $.ajaxError();
.
However, reading the docs isn't helping me as I want to use both of them, and this isn't working for me.
$('#ilmoittuminen').submit(function(){
var ilmoittautumisdata = $('#ilmoittuminen').serialize();
$.ajax({
//url: "",
data: ilmoittautumisdata,
type: "POST"
});
$.ajaxComplete(
function(){
$('#ilmoittuminen').slideUp();
});
$.ajaxError(
function(){
});
return false;
});
How I should do it?