简体   繁体   English

为什么JSF ajax状态成功无法在Chrome中运行?

[英]Why JSF ajax status success not working in Chrome?

When I call an action in my ManagedBean, I also call function JS via JSF ajax to open a load popup while the action is processing as you can see in the following code. 当我在ManagedBean中调用动作时,我还通过JSF ajax调用JS函数,以在动作进行处理时打开加载弹出窗口,如以下代码所示。 This work perfectly in firefox but not in chrome, even works in chrome (only incognito mode). 此功能在Firefox中效果很好,但在chrome中效果不佳,甚至在chrome中也只能使用(仅隐身模式)。 I did debug via console.log and I checked that in chrome the ajax response only reachs the complete status and not success. 我确实通过console.log进行了调试,并且检查了在chrome中,ajax响应只能达到完整状态,而不是成功。

XHTML XHTML

<h:form prependId="false"> 
...
<button class="btn btn-inverse" jsf:action="#{sendSmsMB.sendSms()}">
    <i class="fa fa-save"></i> ENVIAR
   <f:ajax execute="@form" render="@form" onevent="ajaxLoader" />
</button>
</h:form>

JS JS

function ajaxLoader(data){
if(data.status == "begin"){
    $.blockUI({
        message: '<h5> <img src="../../../resources/img/loader_blue.gif" /> 
 <b>Espere que se complete el proceso de carga</b></h5>'
    });
}else if(data.status == "complete"){
    $.unblockUI();
}else if(data.status == "success"){
    $.unblockUI();
}

} }

I think that Chrome has problems with sync calls. 我认为Chrome浏览器在同步通话方面存在问题。 Is your ajax call sync? 您的ajax通话同步了吗? If it's, try to make it async. 如果是这样,请尝试使其异步。 In your ajax call, put below the data: 在ajax调用中,将数据放在下面:

async: false

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

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