Skip to content Skip to sidebar Skip to footer

How Can I Render Html Page Of Django After The Background Celery Task Is Completed

Problems: I am using rabbitmq server with celery I need to run multiple tasks in the background. That i am able to do When each task is completed, i need to render the html page,

Solution 1:

You can use AJAX to get the contents of nothing.html before actually making the POST request. Replace the body with the contents of nothing.html fetched and then, make the POST request which will return the contents of index.html. Replace the body with the final html of index.html received.

Example code:

// js
<script>
  $.ajax({
    url: 'url_to_get_nothing_html',
    type: 'GET',
    success: function(data) {
      $('body').html(data);
      $.ajax({
        url: 'url_to_index_html',
        type: 'POST',
        data: <data>,
        success: function(data) {
          $('body').html(data);
        }
    }
</script>

Post a Comment for "How Can I Render Html Page Of Django After The Background Celery Task Is Completed"