Keep getting No 'Access-Control-Allow-Origin' error with XMLHttpRequest

后端 未结 5 1041
被撕碎了的回忆
被撕碎了的回忆 2020-12-15 08:58

I would have solved this issue by using jQuery $.ajax function but in this case jQuery is not option. Instead I am going with CORS request. I feel there is so

5条回答
  •  暖寄归人
    2020-12-15 09:10

    Remove:

    httpRequest.setRequestHeader( 'Access-Control-Allow-Origin', '*');
    

    ... and add:

    httpRequest.withCredentials = false;
    

提交回复
热议问题