Flask Pagination Redirect
I have a web store that uses Flask and SQLAlchemy in which I implemented pagination on the home page with a route like this: @app.route('/') @app.route('/home') def home(): pag
Solution 1:
You can use javascript to update the query in the url
This function will take two params search in the current url for the key if exist then update it else add it.
js
functionurl_manager(key,value){
const url = newURL(window.location.href);
url.searchParams.set(key,value );
window.location.replace(url)
}
replace the anchor tags with button tag <button class="page_num_btn_class btn btn-info mb-4" type="button">{{ page_num }}</button>
Note- you must have jquery included
<scriptsrc="https://code.jquery.com/jquery-3.1.0.js" ></script>
you can call click event on the button
$(".page_num_btn_class").click(function (e){
url_manager("page",$(this).text())
})
Post a Comment for "Flask Pagination Redirect"