How to change API URL based on user input using Python, Flask and JavaScript

  api, flask, javascript, python
let search = () =>{
    let type = document.getElementById('type').value
    let api = 'http://www.boredapi.com/api/activity?type='
    let url = api + type
    console.log(url)
}

This is the code in JavaScript, my question now is how do I make the url in the browser change to the concatenated url. I need the page to reload with the type set as whatever the user types.

Source: Python Questions

LEAVE A COMMENT