onbeforeunload wait for ajax result

前端 未结 4 1489
梦谈多话
梦谈多话 2021-01-23 15:32

Is it possible for onbeforeunload() function to wait for ajax result and move to a jsp based on the resultvalue or atleast show a message before unloading?

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-23 15:59

    Use a synchronous XmlHttpRequest call ("AJAX" is a mis-nomer).

提交回复
热议问题