可以进行不返回的AJAX调用吗? [英] Possible to make AJAX call that doesn't return?

查看:108
本文介绍了可以进行不返回的AJAX调用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在没有任何响应的情况下发送jQuery.ajax调用或等效调用?当我离开带有onbeforeunload命令的页面时,我想在服务器上触发一些东西,但这不是我需要反馈给客户端的东西,所以我只想发送命令而不是等待响应。

Is it possible to send an jQuery.ajax call or equivalent without any sort of response? I want to trigger something on the server as I leave the page with the onbeforeunload command, but it's not something I need to feedback to the client, so I just want to send off the command and not wait for a response.

这可能吗?

推荐答案

每个请求都有回应。即使服务器抛出错误,响应也会返回错误。

Every request has a response. Even if the server throws an error a response is coming back with the error.

如果您不想添加<<>,则可以忽略响应code>成功回调。

$.ajax({
    url: "theURL",
    data: theData
});

这篇关于可以进行不返回的AJAX调用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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