I'm implementing a UI version of the find command in linux. I take the location and filename parameters for the find command in a cgi form implemented using python. On submit, I draw the form again and want to display the results in a div.
My issue is that the server times out if the find command takes too much time. So I'm trying to dynamically get the results and display them on the ui.
On the server side I'm using the below code to dynamically get the results:
*cmd = subprocess.Popen(["find", location ,"-name", file_name], stdout=subprocess.PIPE)
for line in cmd.stdout:
results.append(line.rstrip("\n"))*
From java script side I'll draw the table dynamically using innerHTML.
I thought of passing the value of results from server to client by using an AJAX call, say every 5 seconds. I'm new to this and would appreciate if anyone could help me by showing me how to do the AJAX part, if it is possible to get the value of a python variable from the client side.