I am currently utilizing Django 2.2 in conjunction with Bootstrap.
The method implemented is as follows:
- Triggering the opening of a modal window,
- User updates the data,
- User saves the data,
- Underlying table from where the window originated is updated and the modal window closes.
All functions smoothly up until this point, however, an issue arises upon attempting to reopen the same window - nothing occurs!
This pertains to the javascript file:
$("#modal-risk-profile").on("submit", ".form-risk-profile", function () {
var form = $(this);
$.ajax({
url:form.attr("action"),
data:form.serialize(),
type:form.attr("method"),
dataType:'json',
success: function(data) {
console.log(data.form_is_valid);
if(data.form_is_valid) {
console.log(data.html_planner_client_list);
$("#id_client_table tbody").html(data.html_planner_client_list);
$("#modal-risk-profile").modal("hide");
console.log("Success!");
}
else {
console.log("Something went wrong.");
$("#modal-risk-profile .modal-content").html(html_form);
}
}
});
return false;
});
The output provided by html_planner_client_list is presented below:
<tr>
<td> Rajesh </td>
<td> 01-04-2000 </td>
<td> Bangalore </td>
<td> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99ebf8f4f8faf1f8f7fdebf8f7b7edfceaedd9fef4f8f0f5b7faf6f4">[email protected]</a> </td>
<td> Salaried </td>
...
No errors detected in Inspector Log or Django logs.
What might be causing the issue?