Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reload flask current page
#1
Hi
I am developing a Flask app that communicates with a back end via pipes.
I need to reload the current page of the Flask app when an update is received from the back end, but cannot see how to do this.

Is there a way of forcing a refresh of the current page?
Reply
#2
I suggest reload some page parts with ajax call to backed, this call to backed can be with some interval.

function fetchdata(){
 $.ajax({
  url: 'fetch_details.php',
  type: 'post',
  success: function(response){
   // Perform operation on the return value
   alert(response);
  }
 });
}

$(document).ready(function(){
 setTimeout(fetchdata,5000);
});
Reply
#3
(Jan-08-2021, 08:19 AM)kashcode Wrote: I suggest reload some page parts with ajax call to backed, this call to backed can be with some interval.

function fetchdata(){
 $.ajax({
  url: 'fetch_details.php',
  type: 'post',
  success: function(response){
   // Perform operation on the return value
   alert(response);
  }
 });
}

$(document).ready(function(){
 setTimeout(fetchdata,5000);
});

Thanks for the response
However, I'm not sure what you are getting at.
I do not need to refresh at an interval but when I get pipe input from a separate program.
In the Flask app the user presses a button which results in a message being sent via a pipe to a separate program. When this other program receives the message it performs some processing and writes a response to the pipe and this is then received by the Flask app. When the Flask app receives the reply I want to reload a page in the Flask app.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Flask run function in background and auto refresh page raossabe 2 7,245 Aug-20-2022, 10:00 PM
Last Post: snippsat
  API auto-refresh on HTML page using Flask toc 2 11,745 Dec-23-2020, 02:00 PM
Last Post: toc
  [Flask]After login page is not redirecting me to dashboard shockwave 0 2,659 May-07-2020, 05:22 PM
Last Post: shockwave
  Flask - adding new page affects all other pages CMR 15 5,468 Mar-28-2020, 04:13 PM
Last Post: CMR
  use Xpath in Python :: libxml2 for a page-to-page skip-setting apollo 2 3,578 Mar-19-2020, 06:13 PM
Last Post: apollo
  Flask - Opening second page via href is failing - This site can’t be reached rafiPython1 2 5,436 Apr-11-2018, 08:41 AM
Last Post: rafiPython1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020