0

I am adding a custom HTTP header to a 204 - no content response in PHP:

header("Success: true");
http_response_code(204);

Question is how can I then read this header in JavaScript?

Edit: Should have mentioned this is for the current page not an Ajax request. From what I can establish there is no way to access http headers from within Javascript so it looks like this is not possible.

NickC
  • 1,253
  • 5
  • 16
  • 23
  • No the header of the current page – NickC Jan 18 '17 at 16:32
  • What page is there when there's no content? Without content, no page, no Javascript. – deceze Jan 19 '17 at 20:47
  • 204 (no content) response – NickC Jan 19 '17 at 21:09
  • Should have explained in a bit more detail. A form can be submitted using either Javascript ({form}.submit()) or even a standard html form submit, that form can then be saved on the server and the server can return an http 204 (no content) response. That way the current page is not replaced with the response. – NickC Jan 23 '17 at 20:56

0 Answers0