title: Alternative to Ajax Call
body: <p>I am making ajax call to execute python script. I am using flask framework to do so. It goes to URL, execute the script and returns the response. But, python script may take about 10 seconds to execute and return the response. Till then, if user closes or reloads the tab, ajax call and script execution gets interrupted. Of course, I don't want that. So, I am searching for alternative to it or any suggestion so that until server is running, python script execution should be completed, even if tab is closed or reloaded.</p>
  
  <p>Flask file :</p>
  
  <pre class="lang-py prettyprint-override"><code>@app.route('/&lt;contest_id&gt;/&lt;task_id&gt;/submit')
  def submit(contest_id, task_id):
      response = os.popen("python3 static/submit.py "+contest_id+" "+task_id).read()
      return response
  </code></pre>
  
  <p>Ajax Call :</p>
  
  <pre><code>$.ajax({
      type: "GET",
      url: "/"+contest_id+"/"+task_id+"/submit",
      success: function(response) {
          // do something
      }
  });
  </code></pre>