0

I have a simple login form that submits to a service. The service has the following behavior

  • If proper auth details are provided, the service accepts the login and redirects the user to the destination
  • If the login credentials are incorrect, the service responds by setting a 'abc-xyz' header. The html page submitting the form needs to read the 'abc-xyz' header and display and error message to the user.

I converted the form to make an AJAX call. Now I can read the response header and show the error message. But I'm running into CORS issues and limitations on the service doesn't permit me to configure the service to add the appropriate CORS headers. So I have to submit the form normally without AJAX. But when I do so (with wrong credentials for testing), the html form page refreshes thus losing all the headers.

Is it even possible to read the response headers with a regular form submission? Thanks.

user6123723
  • 10,546
  • 18
  • 67
  • 109
  • This might answer your Q: http://stackoverflow.com/questions/220231/accessing-the-web-pages-http-headers-in-javascript – Andrew Jun 04 '14 at 03:43
  • @Andrew That link shows how to display headers for calls made with AJAX. As per my post (from above), I cannot use AJAX because of CORS issues. I have to capture the response with a normal form submit. Thank you. – user6123723 Jun 04 '14 at 03:56

0 Answers0