Solve Cross Origin Resource Sharing with Flask

For the following ajax post request for Flask (how can I use data posted from ajax in flask?): $.ajax({ url: "http://127.0.0.1:5000/foo", type: "POST", contentType: "application/json"...