I have radio buttons on page for different insurance plans. On click of any radio button, I do a back-end process. Meanwhile, I want a spinner to load till the time backend process is completed. The code works fine like this:
Without Spinner Model:
$(".insuranceSelection").on("click", function() {
$.ajax({
type: "POST",
url : "/insurance/plans",
async:true,
data : {
insurancePlan : insurancePlan
},
error : function(response, status, msg) {
console.log("error \n" + "Sorry an error has occurred please try again");
},
success: function(response) {
$("body").html(response);
}
});
});
But if I add a spinner model, the spinner loads. But when the backend process is completed, the vertical scroll bar is removed from the page . I can see an error in chrome logs that Uncaught SyntaxError: Unexpected token <
With Spinner Model:
$(".insuranceSelection").on("click", function() {
$('#spinnerModal').modal({
backdrop: 'static',keyboard:false, show: true
});
$.ajax({
type: "POST",
url : "/insurance/plans",
async:true,
data : {
insurancePlan : insurancePlan
},
error : function(response, status, msg) {
console.log("error \n" + "Sorry an error has occurred please try again");
},
success: function(response) {
$("body").html(response);
}
});
});
PS: This error does not come if I remove spinner model from js.
Request you to help asap.
Thanks in advance.