search

Home  >  Q&A  >  body text

javascript - How to ensure that several ajax submissions are successful;

Click save to submit multiple ajaxes and exit after success

習慣沉默習慣沉默2773 days ago487

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-05-16 13:41:22

    If it is jQuery, you can use $.when(), such as:

    $.when($.ajax(url1),$.ajax(url2)).done(function(){alert("ok!")});

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 13:41:22

    Promise

    reply
    0
  • Cancelreply