I encountered an issue with an ajax load in Firefox. Every time I try to load, I keep receiving a message that says 'unreachable code after return statement'. Despite my efforts to find a solution, I have not been successful in resolving it. Interestingly, the script works perfectly fine on other browsers such as Edge, Chrome, and Safari. The functionality involves a button that triggers an AJAX call to load a PHP page and display its content in a specific div element. Below is the code snippet with added alert messages. In Firefox, the functionality behaves erratically - sometimes working, taking too long to load, or failing completely. Has anyone else faced a similar problem before? Any assistance would be greatly appreciated.
$(document).ready(function(){
$(".mainstuff button").click(function(){
$('#loader').show();
status = $(this).attr("data-name");
var new_url = "demo_text.php?job_id="+status;
//alert(status);
$("#div1").load(new_url);
});
});
$(document).ajaxStop(function() {
alert("LOADED");
$('#loader').hide();
return true;
});