我应该等待阿贾克斯完成重定向页面?重定向、页面、阿贾克斯

由网友(晚)分享简介:我知道的如何的等待AJAX​​来完成的,但如果我要重定向页面后,一些Ajax调用被解雇了,我要等他们重定向之前完成?有没有关系呢?I know how to wait for ajax to complete, but if I'm going to redirect a page after some ajax c...

我知道的如何的等待AJAX​​来完成的,但如果我要重定向页面后,一些Ajax调用被解雇了,我要等他们重定向之前完成?有没有关系呢?

I know how to wait for ajax to complete, but if I'm going to redirect a page after some ajax calls are fired off, should I wait for them to complete before the redirect? Does it matter?

推荐答案

如果你有信心,Ajax调用会成功,那么一旦Ajax调用发生,重定向不会影响它只要您的服务器关心。但不要忘了,客户可能会失去他们的连接,或一些可能发生的错误,所以你可能需要等待,以确保调用是成功的。另一个要考虑的是你的Ajax调用是否会影响到任何网页你会重定向到。在这种情况下DEFINITELY等待重定向之前。你不会希望你的用户重定向到一个破碎的页面,因为它们的连接很慢或者服务器过打嗝。

If you're confident that the ajax call will be successful, then once the ajax call has occurred, redirecting won't affect it as far as your server is concerned. But don't forget, the client could lose their connection or a number of errors could occur, so you should probably wait to make sure the calls were successful. Another thing to consider is whether or not your ajax calls will affect whatever page you're going to redirect to. In that case DEFINITELY wait before redirecting. You won't want your user to get redirected to a broken page because their connection was slow or your server had a hiccup.

阅读全文

相关推荐

最新文章