JavaScript xhr.getAllResponseHeaders() returns only one header

We have Node.js as a server which helps in getting us remote rest service, from client html I am trying to get response headers from the jQuery Ajax call using below code:

$.ajax({
  type: "get",
  url: newUrl,
  crossDomain: true,
  cache: false,
  dataType: "json",
  contentType: "application/json; charset=UTF-8",
  success: function(data, textStatus, xhr) {
    var responseText = JSON.stringify(data);
    alert(xhr.getAllResponseHeaders());
  },
  error: function (xhr, textStatus, errorThrown) {
    console.log(errorThrown);
  }
});

But the problem is, I only get one one response header: Content-Type: application/json remaining things are ignored. From my research I found that I need to add Access-Control-Allow-Headers to make that available. So in Node I tried like this:

res.writeHead(200, {
  'Content-Type': 'application/json',
  'Access-Control-Allow-Origin': '*', 
  'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE',
  'Access-Control-Allow-Headers': 'Content-Type, Access-Control-Allow-Origin'
});

But still I get only the one header Content-Type. Can you help in identifying this issue? By the way, it's a cross domain calls.

Answer:1

I have function for validation for check below scenarios, but function used map and filter methods. so its not working in IE8.How to rewrite this function without using map and filter. var case1 = "...

I have function for validation for check below scenarios, but function used map and filter methods. so its not working in IE8.How to rewrite this function without using map and filter. var case1 = "...

  1. custom javascript validation
  2. custom javascript validation mvc
  3. javascript custom validation message
  4. javascript custom validation function
  5. javascript custom validation error message
  6. custom validation javascript asp.net
  7. javascript custom validation rules
  8. custom validation javascript adobe
  9. custom javascript form validation
  10. nintex custom javascript validation
  11. javascript custom input validation
  12. html5 custom validation javascript
  13. custom email validation javascript
  14. create custom validation javascript
  15. custom date validation javascript
  16. nintex forms custom javascript validation
  17. contact form 7 custom javascript validation
  18. sharepoint custom validation javascript

Context: I'm trying to make sure that an object passed to a function is valid before I use it. And I'd like to know if there is any difference between the two approaches, one is more syntactically ...

Context: I'm trying to make sure that an object passed to a function is valid before I use it. And I'd like to know if there is any difference between the two approaches, one is more syntactically ...

  1. determine object type python
  2. determine object type in r
  3. determine object type javascript
  4. determine object type java
  5. determine object type c#
  6. determine object type vba
  7. determine object size from picture
  8. determine objectives
  9. determine object type matlab
  10. determine object type powershell
  11. determine objectives spiral model
  12. determine objective function
  13. determine object type from id salesforce
  14. determine object class python
  15. determine object class r
  16. determine object type php
  17. determine object class java
  18. determine object size python
  19. determine object size javascript
  20. determine object height

<input id="phone" name="phone" placeholder="(XXX)XXX-XXXX" type="tel" pattern="^(?:\(\d{3}\)|\d{3})[- ]?\d{3}[- ]?\d{4}$" required="true"/> How can I validate if that pattern is used in ...

<input id="phone" name="phone" placeholder="(XXX)XXX-XXXX" type="tel" pattern="^(?:\(\d{3}\)|\d{3})[- ]?\d{3}[- ]?\d{4}$" required="true"/> How can I validate if that pattern is used in ...

  1. validate regex
  2. validate regex online
  3. validate regex javascript
  4. validate regex java
  5. validate regex c#
  6. validate regex php
  7. validate regex python
  8. validate regex js
  9. validate regex laravel
  10. validate regex online java
  11. validate regex pattern
  12. validate regex jquery
  13. validate regex expression
  14. validate regex rails
  15. validate regex angular
  16. validate regex c# online
  17. validate regex javascript online
  18. validate regex jsf
  19. validate regex typescript
  20. validate regex email

I am currently working on some IE11 compatibility issues. The code is fully functional in compatibility mode as it was previously optimize last for IE5. The affected code is as follows: /* * This ...

I am currently working on some IE11 compatibility issues. The code is fully functional in compatibility mode as it was previously optimize last for IE5. The affected code is as follows: /* * This ...

  1. javascript runtime error '$' is undefined
  2. javascript runtime error function is undefined
  3. javascript runtime error 'jquery' is undefined
  4. javascript runtime error access is denied
  5. javascript runtime error function expected
  6. javascript runtime error 'promise' is undefined
  7. javascript runtime error '__dopostback' is undefined
  8. javascript runtime error invalid character
  9. javascript runtime error 'sys' is undefined
  10. javascript runtime error 'angular' is undefined
  11. javascript runtime error object expected
  12. javascript runtime error out of stack space
  13. javascript runtime error 'json' is undefined
  14. javascript runtime error example
  15. javascript runtime error expected ' '
  16. javascript runtime error 'require' is undefined
  17. javascript runtime error argument not optional
  18. javascript runtime error 'google' is undefined
  19. javascript runtime error hierarchyrequesterror
  20. javascript runtime error invalid template