Ajax does not return callback on ios

Asked

Viewed 96 times

0

I have the following problem, when I try to run my code it arrive in beforeSend but it does not return me if an error happened or was executed successfully, someone could help me with this. On PC and Android it works normally and does the redirect and even shows the error when it happens.

event.preventDefault();

var formData = new FormData($(this)[0]);

//$("#stepTwoForm button[type=submit]").attr('disabled', 'disabled');
$('#alertError').hide();

clearColorFields();

$.ajax({
    type: "POST",
    url: "/app/cadastro/passo3-store",
    async: true,
    cache:false,
    data: formData,
    contentType: false,
    processData: false,
    dataType: 'json',
    beforeSend: function(){
        alert('enviou');
    },success: function (data) {
        if (data.url) {
            window.location.href = data.url
        }
    },
    error: function (data) {
        $("#stepTwoForm button[type=submit]").removeAttr('disabled');
        $('.loader').css('visibility', 'hidden').css('opacity', '0');
        $('#stepTwoForm button[type=submit]').css('visibility', 'visible').css('opacity', '1').css('height', '40px');
        $('#alertError').html(data.responseJSON.messages);
        $('#alertError').show();
        alertRequests('error', data.responseJSON.messages, 'alertStoreProvider');
        colorRequiredFields(data.responseJSON.fields);
    }
});
  • "async: true,".. Ajax is already async

  • Dude, I tested it on iOS and it worked like a grape.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.