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", data: JSON.stringify({'inputVar': 1}), success: function( data ) { alert( "success" + data ); } }); I get a Cross Origin Resource Sharing (CORS) error: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code