I have successfully installed CartoDB in Ubuntu 14.04 LTS and uploaded a point geometry dataset. I have created a HTML/JS application to access the layers from the local cartodb and visualize in the leaflet client application using cartodb.createLayer.
I need to display a chart by using the data from the uploaded layer. When I try using CartoDB SQL API, I get the CORS error. The details are below.
Can you let me know whether we need to include any configuration for CORS in local cartoDB?
Code:
$.getJSON('http://development.localhost.lan:3000/api/v2/sql?q=SELECT * FROM tablename & api_key = 1a77a491a96dff1c380fc869498587db105c5b65', function(data) {
console.log(data);
$.each(data.rows, function(key, val) {
// do something!
});
});
Error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://development.localhost.lan:3000/api/v2/sql?q=SELECT%20*%20FROM%20%22qgis_view_standard_all_permits_processed_current%22%20&%20api_key%20=%201a77a491a96dff1c380fc869498587db105c5b65. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).