Allow cors in Flask api for d3.xhr

I'm writing a simple Flask api that will serve data to a d3.js frontend and I am getting this error when I try to query for the data:

XMLHttpRequest cannot load localhost:5000/data/sample_data. Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource.

I am using the flask-cors extension for flask, even though I am querying from my own domain (localhost) so I thought that this shouldn't even count as "Cross-domain". Can anyone shed some light on why this isn't working?


URLs should have a valid schema for CORS to kick in. While Chrome's address bar can prefix the schema for URLs, most AJAX libraries (jQuery, d3, etc.) do not smartly do it before making the request.

Appending http:// to the URL(s) should fix the problem.

Need Your Help

Pagination not adding the class

php codeigniter pagination codeigniter-2

I am using pagination and here is the code

How do I associate a parent node with all of its children in an event listener? jQuery / JavaScript

javascript jquery html parent-child eventlistener

I'm not extremely good with JavaScript, as I've only been coding as a hobby for a little over a year now, so forgive me if this question seems stupid. I'm also new to posting here on StackOverflow.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.