Start a new topic

API request with ajax

I'm trying to do a get request with ajax to get the product details, but I got CORS error


Access to XMLHttpRequest at 'https://judge.me/api/v1/products/5x11-back-in-black-500-sheets' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.



I tried from localhost, from a webserver, from shopify and I got the same


using postman works


Do I need something extra in the request?


Thanks


here the jquery example


let url = "https://judge.me/api/v1/products/5x11-back-in-black-500-sheets";                        

    $.ajax({

          url: url,

                      type: 'GET',

                       data: raw,

                       crossDomain: true,

                       dataType: "json"

        }, {

     success: function(data) {

        console.log(data);

  },

     error: function(err) {

        console.log(err);

     }

   });

1 Comment

Hello Pedro,


Thank you for reaching us.


For security reason we don't support Ajax API request as the request contains token data.


Should you have any concerns, please let us know.


Best,

Login or Signup to post a comment