I'm building a library to save watched series and I'm struggling with some sort of incompatibility with my JQuery script. It works as intended in Chrome and Edge but not in Firefox. The reason of this script is to populate a div with content.
<script>
jQuery(document).on('submit', '.seasons_form', function(e){
event.preventDefault();
$.ajax({
type: "POST",
url: $(this).attr("action"),
data: $(this).serialize(),
success:function(data){
;
document.getElementById("chapters_container").innerHTML = (data);
},
error:function(xhr,exception)
{
}
})
e.preventDefault();
});
</script>
In Firefox it redirects me to the function I'm calling instead of populating the div. I have read several similar problems here but I can not find the solution.
Is anyone able to help? Thanks in advance.
error:function()isn't actually blank in the code you're using. Letting errors fall through the cracks like this is really bad practice. At a minimum, you should be doing an alert out to the user to let them know something didn't work as expected.