How to Fix CORS policy: No 'Access-Control-Allow-Origin' Error

i am trying to scrap data from Website name Kijiji but it throws a CORS policy Error i tried using Access-Control-Allow-Origin: * but it didn’t work out. Here’s my code

$(document).ready(function () {
 var feeds = ["",

    feeds.forEach(feed => $.ajax( feed, {
        accepts: {
            xml: "application/rss+xml",
            Access-Control-Allow-Origin: *
        dataType: "xml",
        success: function (data) {

There isn’t a good way around it, for allowing your service to access the data is something the other server needs to support. One solution is to use an intermediate server that bypasses CORS along with taking your actual request and returning the right data.

You can see that approach used here: Checking If A File Exists


Bro is there any alternative way

No. The whole reason CORS exists is to protect sites from having 3rd party/untrusted sources access to their content :see_no_evil:

I found one website which instruct to apply Header on your server in my case i am using Apache how to set header in that

Give it a shot. My guess is that, unless the server you are requesting data from loosens their restrictions, you won’t be successful.