Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

fetch api flask url redirect

//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 by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #fetch #api #flask #url #redirect
ADD COMMENT
Topic
Name
4+6 =