发送ajax请求而不等待回答 [英] send ajax request without waiting answer

查看:72
本文介绍了发送ajax请求而不等待回答的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想发送一个ajax请求来发送一些信息,并在发送后立即(无论我是否收到错误/成功)进行重定向(无需等待服务器响应)

I want to make an ajax request to send some information and immediately after sending it (doesnt matter if I get an error/success) make a redirection (without waiting server response)

我想知道我是否做了类似

I was wondering if I do something like

$.ajax({
url:_myurl_,
timeout:500,
success:function(){document.location= _redirectUrl_},
error: function(){document.location= _redirectUrl_}
})

可行吗?添加超时是否会取消我的请求?

will work fine? Does adding a timeout wont cancel my request?

推荐答案

async:false异步模式进程中的
不等待完成其他流程

async: false in async Mode process are not wait to complete other process

这篇关于发送ajax请求而不等待回答的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆