开发者

Make ajax POST without requiring a response?

开发者 https://www.devze.com 2023-03-21 04:54 出处:网络
Is there a way to make an $.ajax POST request: without requiring a response so the server doesn\'t even try to return anything

Is there a way to make an $.ajax POST request:

  1. without requiring a response
  2. so the server doesn't even try to return anything

Are there some HTTP headers to accomplish this? The goal would be to track statistics with minimal server and client request process开发者_运维技巧ing.


The server should return a HTTP/204 No Content response. That's as close as you can get.


If it is no problem in terms of security, and the amount of data you send is at maximum 2K minus the length of your URL, use a GET request instead. A GET request sends only one TCP packet, instead of two packets as a POST request does (first the header, then the data).

0

精彩评论

暂无评论...
验证码 换一张
取 消