简体   繁体   English

AJAX.call是否可以在除Firefox外的所有浏览器中使用?

[英]AJAX.call working in all browsers apart from firefox?

I am having a problem with an ajax load in firefox? 我在Firefox中的ajax加载有问题吗? I keep getting this message 'unreachable code after return statement' I have looked for what it is but cant really get to the bottom of it. 我不断收到此消息“在return语句后无法访问代码”,我一直在寻找它的内容,但无法真正深入了解它。 It works well in edge, chrome, safari etc. Its just a button that when clicked loads a php page and displays in a div. 它在edge,chrome,safari等环境中都能很好地工作。它只是一个按钮,单击该按钮即可加载php页面并显示在div中。 The code is here with added alert. 该代码在此处带有添加的警报。 When in firefox it works sometimes or takes forever to load or not at all? 在Firefox中时,它有时起作用还是需要永久加载或根本不加载? Has anyone else came across this problem? 还有其他人遇到过这个问题吗? Any help 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;
});

As strange as it sounds, I fixed the problem by taking out google analytics code which wa causing the problem. 听起来很奇怪,我通过取出导致问题的Google Analytics(分析)代码解决了该问题。 Wierd! 奇怪!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM