Fetch Api Flask Url Redirect

[Solved] Fetch Api Flask Url Redirect | Python Frameworks Flask - Code Explorer | www.yomemimo.com
Question : fetch api flask url redirect

Answered by : anxious-anteater-0pf57grv8ipj

fetch('url',{ method:'POST' }) .then((response)=>{ if(response.redirected){ window.location.href = response.url; } }) .catch(function(e){ })

Source : https://stackoverflow.com/questions/64636415/flask-how-to-redirect-after-fetch-post | Last Update : Mon, 01 Nov 21

Question : fetch api flask url redirect

Answered by : anxious-anteater-0pf57grv8ipj

//python
flash('some message for index page')
return redirect(url_for('index'))
//js
fetch('url',{ method:'POST' }) .then((response)=>{ if(response.redirected){ window.location.href = response.url; } }) .catch(function(e){ })

Source : https://stackoverflow.com/questions/64636415/flask-how-to-redirect-after-fetch-post | Last Update : Mon, 01 Nov 21

Answers related to fetch api flask url redirect

Code Explorer Popular Question For Python Frameworks Flask