简体   繁体   中英

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. This work perfectly in firefox but not in chrome, even works in chrome (only incognito mode). I did debug via console.log and I checked that in chrome the ajax response only reachs the complete status and not success.

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

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. Is your ajax call sync? If it's, try to make it async. In your ajax call, put below the data:

async: false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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