There is a form on ajaxForm. After receiving the answer, if the answer is equal to some value, I would output this answer with an alert, now I need to make another request instead of the output, but he does not want, that is, succes does not come back.

$(document).ready(function () { $("#orderform").ajaxForm({ success: contact_success }); }); function contact_success(responseText, statusText) { if (responseText == 'Ваш заказ отправлен.') { alert(responseText); document.location = '../zakaz-prinyat/'; } else { alert(responseText); } } 

Instead of alert(responseText); I want another ajax request .... But nothing happens, tell me.

    1 answer 1

    Probably not document.location = '../zakaz-prinyat/'; , and document.location.href = '../zakaz-prinyat/'; .. But not the essence :) I understand that an AJAX request is needed here:

     else { alert(responseText); } 

    What's the problem, some kind of mistake?

    • Yes, the request does not work here. I assume this is due to the fact that I am trying to trigger a request in the response of another ajax request. - avengerweb
    • There should be no problem with this. Bring the code together with the new AJAX request, then something will probably clear - Valentina Predtechenskaya