Skip to content Skip to sidebar Skip to footer

X-requested-with Is Not Allowed By Access-control-allow-headers

I am developing one system. In that system there is one add item to cart functionality. In that functionality, I am using Jquery $.ajax used. But online server I have facing this e

Solution 1:

The error can be fixed by adding

header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');

in the server where ajax call leads to....

Solution 2:

Remove this:

  headers: {
    "Access-Control-Allow-Headers": "X-Requested-With",
    "X-Requested-With": "XMLHttpRequest"        
  },

Access-Control-Allow-Headers is a response header, not a request header.

The server you are making the request to does not allow X-Requested-With.

Post a Comment for "X-requested-with Is Not Allowed By Access-control-allow-headers"