[Answered ]-A.toLowerCase when add CORS to the ajax header

2👍

setRequestHeader accepts two strings, the header name and its value, not an object. See The jqXHR section of the $.ajax entry of the jQuery docs for more information.

You should replace the object in the parameter with two calls to set those headers individually:

$.ajaxSetup({
     beforeSend: function(xhr) {
        xhr.setRequestHeader('CORS', 'Access-Control-Allow-Origin');
        xhr.setRequestHeader('token', 'tokenStringHere');
    }
});

Leave a comment