When AJAX is used, the above cross domain request error is reported (using Python
flash
to build the background)
Error code:
from flask import Flask,render_template
@app.route("/markdownlang/",methods=["post"])
def getMarkdownLang():
return render_template('result.html')
Solution: add a response header on the server side to simply allow cross source.
from flask import Flask,render_template,make_response
@app.route("/markdownlang/",methods=["post"])
def getMarkdownLang():
resp = make_response(render_template('result.html'))
resp.headers['Access-Control-Allow-Origin'] = '*'
return resp
There are two other things that can go wrong:
-
- the requested path is not complete. Full path http://127.0.0.1:port number/file path. Cross source must have full path. The request mode has no corresponding response code on the server side. For example, the server should have a post response for a post request
Read More:
- How to Fix ERROR Couldn’t connect to Docker daemon at http+docker://localunixsocket
- SourceTree Git Error: remote: HTTP Basic: Access denied fatal: Authentication failed
- [Solved] Error: Cannot run with sound null safety, because the following dependenciesdon‘t support null safe
- [Solved] Illegal access: this web application instance has been stopped already
- [GO]Solve request origin not allowed by Upgrader.CheckOrigin websocket cross-domain
- TypeException: Error setting non null for parameter #1 with JdbcType null
- [Solved] Keil5 Error: error 65: access violation at 0x08040000 : no ‘execute/read‘ permission
- Android Working Directory:NULL Environment:NULL Error
- Mybatis Integrate SQLSERER Null Value Error: Error setting null for parameter # with JdbcType OTHER
- Tomcat Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors
- error: remote origin already exists [How to Solve]
- Template cannot be rendered due to the joint query of populate in mongoose: syntax error: unexpected token r in JSON at position 0
- [Solved] Error: ER_ACCESS_DENIED_ERROR: Access denied for user ‘root’@‘localhost’ (using password: YES)
- error: remote origin already exists. [How to Solve]
- [Solved] Mac Install homebrew Error: error: Not a valid ref: refs/remotes/origin/master
- Git pull and Git pull origin master Warning: Pulling without specifying how to reconcile divergent branches
- [Solved] Jenkins-ERROR: Error cloning remote repo ‘origin‘
- [Solved] Windows Nginx Startup Error: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket
- [Solved] net core HTTP Error 500.31 – Failed to load ASP.NET Core runtime HTTP Error 500.30 – ASP.NET Core
- JZVideo Error: Attempt to invoke virtual method ‘android.view.Window android.app.Activity.getWindow()’ on a null object reference