如何在调用下一个Javascript函数之前更新浏览器?
我在从我的函数中获取所需的功能时遇到了一些问题。。。基本上,我对AJAX函数进行了两次调用(由OracleApex提供,因此我无法更改这些函数),但它们需要一段时间。我想在动作进行时展示标准的AJAXy旋转gif,但我运气不太好。以下是我目前掌握的情况:如何在调用下一个Javascript函数之前更新浏览器?,javascript,jquery,ajax,oracle-apex,Javascript,Jquery,Ajax,Oracle Apex,我在从我的函数中获取所需的功能时遇到了一些问题。。。基本上,我对AJAX函数进行了两次调用(由OracleApex提供,因此我无法更改这些函数),但它们需要一段时间。我想在动作进行时展示标准的AJAXy旋转gif,但我运气不太好。以下是我目前掌握的情况: function paginate(reportIDs, startRecord) { //block access to the UI and show a "please wait" message $.blockUI({ css:
function paginate(reportIDs, startRecord)
{
//block access to the UI and show a "please wait" message
$.blockUI({ css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
} });
//make the two AJAX calls to the APEX provided function
for(var i = 0;i<reportIDs.length;i++)
{
$a_report(reportIDs[i], startRecord, ITEMS_PER_PAGE, ITEMS_PER_PAGE);
}
//clean up some APEX garbage on the page
formatPage();
//make the "please wait" message go away
$.unblockUI;
}
函数分页(ReportId、startRecord)
{
//阻止对UI的访问并显示“请稍候”消息
$.blockUI({css:{
边界:“无”,
填充:“15px”,
背景颜色:“#000”,
“-webkit边界半径”:“10px”,
“-moz边界半径”:“10px”,
不透明度:.5,
颜色:'#fff'
} });
//对APEX提供的函数进行两次AJAX调用
对于(var i=0;i假设调用是异步的
——您可以将回调传递到ajax报告函数中,或者使用另一个函数或常量来设置回调吗?否则您必须轮询响应——您将如何做将取决于从$a_report
返回的内容和/或其ajax功能背后的api
如果它们不是async
,那么可能是输入错误或其他问题。正如另一张海报所建议的$.blockUI;
应该是$.blockUI();
用另一种方法包装ajax,并将该方法延迟1毫秒
function paginate(reportIDs, startRecord)
{
//block access to the UI and show a "please wait" message
$.blockUI({ css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
}
});
setTimeout(function(){
//make the two AJAX calls to the APEX provided function
for(var i = 0;i<reportIDs.length;i++)
{
$a_report(reportIDs[i], startRecord, ITEMS_PER_PAGE, ITEMS_PER_PAGE);
}
//clean up some APEX garbage on the page
formatPage();
//make the "please wait" message go away
$.unblockUI();
}, 1);
}
函数分页(ReportId、startRecord)
{
//阻止对UI的访问并显示“请稍候”消息
$.blockUI({css:{
边界:“无”,
填充:“15px”,
背景颜色:“#000”,
“-webkit边界半径”:“10px”,
“-moz边界半径”:“10px”,
不透明度:.5,
颜色:'#fff'
}
});
setTimeout(函数(){
//对APEX提供的函数进行两次AJAX调用
对于(var i=0;i