I am developing an HTML page where I want to get the prices of the products sold on Flipkart.
I have done following code to get items:
$(document).ready(function(){
$.ajax({
url: "https://affiliate-api.flipkart.net/affiliate/search/json?query=sony+mobiles&resultCount=5",
type: "GET",
headers:{"Accept" : "application/json;odata=verbose", "Fk-Affiliate-Id" : "[ID]", "Fk-Affiliate-Token": "[Token]","Access-Control-Allow-Origin" : "*"},
success: function(){console.log("Success");},
error: function(){console.log("Fails");}
});
});
But the execution always goes to error
part. If I run the same query in the REST API tool i.e. Yet another rest client (a chrome tool), I am getting the response. What am I missing here?