In my custom module, i wanna show the Loading message before redirect or before ajax proceding
I have tried the ajaxStatus.flashStatus and ajaxStatus.showStatus in my javascript, but neither of them could popup the Loading message.
and there is no javascript error message.
ajaxStatus.flashStatus(SUGAR.language.get(‘app_strings’, ‘LBL_LOADING’),800);
ajaxStatus.showStatus(SUGAR.language.get(‘app_strings’, ‘LOADING’));
My first attempt to debug this code is to write an alert message or to log a test message to console in order to check if the code is accessible by the script .
Your code may be not reachable or should be triggered by a specific event such as on document ready.
Also use this:
SUGAR.ajaxUI.showLoadingPanel();
SUGAR.ajaxUI.hideLoadingPanel();
2 Likes
Hi @sona1 , Did you call the loading panel inside Ajax? I tried this one, but mine was not working.
<script type="text/javascript">
{literal}
$('#confirm').click(function(e) {
e.preventDefault();
var id ="{/literal}{$opportunity_id}{literal}";
var sales_stage = "{/literal}{$sales_stage}{literal}";
var dataString = 'id='+id+'&type='+sales_stage;
$.ajax({
type:'POST',
data:dataString,
url:'index.php?entryPoint=salesStageEntryPoint',
beforeSend: function(){
$('#confirmDialog').modal('hide');
SUGAR.ajaxUI.showLoadingPanel();
},
complete: function(){
SUGAR.ajaxUI.hideLoadingPanel();
},
success:function(data) {
alert(data);
window.location.reload();
}
});
});
{/literal}
</script>