繁体   English   中英

为什么此功能适用于Firefox,但不适用于Chrome或IE?

[英]Why does this work with Firefox but not Chrome or IE?

当在HTML页面上单击process_2banner按钮时,我将运行以下代码。 此代码执行了使用Firefox时应该执行的操作。 使用Chrome和Internet Explorer时,会调用ajax代码,但div spinner_block不会按代码意图显示/隐藏。 奇怪的是,如果我在Chrome中打开萤火虫并在ajax调用之前(在.css("display","block")语句之后放置一个断点,它会起作用。显示spinner_box <div> ,然后在ajax调用返回之后,隐藏。

你能看到这里有什么问题吗? 非常感谢你! 安德烈斯

$('#process_2banner').on("click",function() {
    var postdata = "lead_id="+rowId;   //needs to include the pidm of the user clicking the button
    $('#spinner_box').css("display","block");
    $('#spinner_box').html('Wait, we are processing the record..');
    $('#spinner_box').css("display","block");
    $.ajax({type: "POST",
        url: "insert_srwordpress.php",
        data:postdata,
        success:function(result) {
            if (result.isOk == false) { 
                alert('Some error occurred while writing Banner') } 
            else { 
                $('#spinner_box').hide();
            }
        },
        async: false});
});

响应结果是JSON格式的字符串? 使用之前,您可能需要解析JSON?

例:

var jData = $.parseJSON(result);

if (jData.isOk === false) {

  }

暂无
暂无

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

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