I have created html page with form submit. On submit i am calling ajax post request.
But throws a error 
Failed to load http://radius.a3techlabs.com/app/custom/verifyAccessOTP: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains the invalid value ''. Origin 'null' is therefore not allowed access.
$.ajax({
      url: 'http://radius.a3techlabs.com/app/custom/verifyAccessOTP',
      dataType: 'json',
      type:'post',
      headers: {
          "charset":"UTF-8",
          "accept": "application/json",
          "Access-Control-Allow-Origin":"*",
          "Access-Control-Allow-Credentials":"true",
        },
      data:value,
      success: function(data) {
        console.log(data);   
        alert(data.message);
      }.bind(this),
      error: function(xhr, status, err) {}.bind(this)
    });
                module.exports.cors = {
  allRoutes: false,
  origin: '*',
  credentials: true,
  methods: 'GET, POST, PUT, DELETE, OPTIONS, HEAD',
  headers: 'content-type'
};
changed
allRoutes:true
module.exports.cors = {
  allRoutes: true,
  origin: '*',
  credentials: true,
  methods: 'GET, POST, PUT, DELETE, OPTIONS, HEAD',
  headers: 'content-type'
};
it works,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With