I am forced to do a reload of the entire web page through the Ajax success response. I am currently using .html function, though not ideal I need the entire page to be reloaded since I cannot control the response. I even tried document.write.
However, after reloading the page the javascript stops working on the form which is dynamically rendered. I checked and the following solutions such as .on or innerHTML do not apply since I am refreshing the entire page. Can I do the entire page reload using any other way or force javascript to load the form that is created dynamically?
My current code -
$.ajax({
type: 'post',
url: 'visaMatrix.php',
data: $('#<?php echo $template_form_id ?>').serialize(),
success: function (response) {
//Display the result on the entire web page.
$('#modalLoading').modal('hide');
$("html").html(response);
},
error: function(response){
$(".loadingContainer").html("Looks like we had a problem. Please close the window and try again.");
}