106 lines
6.9 KiB
HTML
Executable File
106 lines
6.9 KiB
HTML
Executable File
{% extends "mnfapp/base.html" %}
|
|
{% load static %}
|
|
{% load doc2pdf %}
|
|
{% block content %}
|
|
<center>
|
|
<div class="lds-dual-ring">
|
|
<h3 style="padding: 1em;">
|
|
|
|
We are processing your Book. <br>
|
|
We will notify once your conversion is generated.
|
|
</h3>
|
|
</div>
|
|
<div class="cbody">
|
|
<h1> <a href="{% url 'view_conversion' %}" style="text-decoration: none;"> My Converted Books</a> </h1>
|
|
</div>
|
|
</center>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
|
|
|
<script>
|
|
$(document).ready(function () {
|
|
//alert('go')
|
|
// $('.lds-dual-ring').hide();
|
|
|
|
// $('#translateBtn').click(function () {
|
|
console.log("inside jquery");
|
|
var intervalId = window.setInterval(function () {
|
|
/// call your function here
|
|
$.ajax({
|
|
type: 'GET',
|
|
data: {
|
|
book_id: {{book_id}},
|
|
|
|
},
|
|
|
|
url: "{% url 'is_book_converted' %}",
|
|
contentType: "application/json",
|
|
statusCode: {
|
|
200: function () {
|
|
alert("Story Conversion Generated Successfully!");
|
|
clearInterval(intervalId);
|
|
},
|
|
202: function () {
|
|
console.log("conversion in progress");
|
|
},
|
|
505: function () {
|
|
console.log("some error occurred");
|
|
clearInterval(intervalId);
|
|
}
|
|
},
|
|
});
|
|
}, 10000);
|
|
|
|
|
|
|
|
$.ajax({
|
|
type: 'GET',
|
|
data: {
|
|
book_id: '{{book_id}}',
|
|
|
|
|
|
},
|
|
url: "{% url 'my_book' %}",
|
|
contentType: "application/json",
|
|
|
|
statusCode: {
|
|
200: function () {
|
|
console.log("Book Conversion Generated Successfully!");
|
|
},
|
|
505: function () {
|
|
console.log("Some error occurred");
|
|
clearInterval(intervalId);
|
|
},
|
|
},
|
|
beforeSend: function () {
|
|
$('.lds-dual-ring').show();
|
|
$('.cbody').hide();
|
|
},
|
|
complete: function (data) {
|
|
$('.lds-dual-ring').hide();
|
|
$('.cbody').show();
|
|
console.log(data);
|
|
},
|
|
success: function (data) {
|
|
printdata(data)
|
|
},
|
|
error: (error) => {
|
|
console.log(JSON.stringify(error));
|
|
}
|
|
// })
|
|
// error: function (xhr, status, error) {
|
|
// var err = eval("(" + xhr.responseText + ")");
|
|
// alert(err.Message);
|
|
// })
|
|
|
|
})
|
|
})
|
|
function printdata(data) {
|
|
alert("Book Conversion Generated Successfully!")
|
|
// $.each(data.mob, function (index, value) {
|
|
// $(".mainc").after("<tr><td>" + value + "</td><td>" + data.status[index] + "</td></tr>");
|
|
// });
|
|
}
|
|
</script>
|
|
|
|
|
|
{% endblock content %} |