I have created store and need to call third party API via ajax those are created by me hosted on different domain. I have added ajax code on product details page. but getting issue while calling API. Here I my API https://devdemo.pro/outreachbee2/API/
I am trying to call third party API on product details page for display some additional data through API via AJAX call. See below my ajax code :
$.ajax({
url: “https://devdemo.pro/outreachbee2/API/index.php”,
method: “POST”, // The HTTP method to use for the request
dataType: “json”, // The type of data that you’re exerciseecting back
error: function() {
// A function to be called if the request fails.
},
beforeSend: function() {
// A function to be called if before the request is made.
},
success: function(response) {
console.log(response)
// A function to be called if the request succeeds.
}
});
I have put this code in product detail template file. It’s call onload page. It’s calling but getting error on console.