firefox跟chrome的$.post()有什么区别吗?

 $.post(url, JSON.stringify(send_data), function(data, ts){},'json');

 window.location.href = "http://" + localStorage.ServerIP;

点击退出按钮以后向后端发送send_data,然后跳转到ServerIP

在chrome下后端可以收到send_data,但是Firefox下不能收到

只有把post设为同步,Firefox才能收到send_data

请问下有没有什么好的方法(除了设置同步),让前端发送完send_data以后再进行跳转?


            $.ajax({
                type:"post",
                url:url,
                async:false,
                data:JSON.stringify(send_data),
                dataType:"json",
                success:function(data){
                }
            });

改用这种格式就能成功跳转+发送数据,这是为啥?

阅读 1.5k
1 个回答
success:function(data){
    window.location.href = "http://" + localStorage.ServerIP;
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题