Home >Web Front-end >JS Tutorial >jquery.blockUI.js upload scrolling wait effect implementation ideas and code_jquery

jquery.blockUI.js upload scrolling wait effect implementation ideas and code_jquery

WBOY
WBOYOriginal
2016-05-16 17:40:121059browse

Requested url:

Copy code The code is as follows:

function request(url, onSuccess, paras , method, isAsync, isMask) {
$.ajax({type:method,url:url,async:isAsync,data:paras,success:function(request){onSuccess(request,isMask);},error: function(e) {if(isMask)
$('#div_mask').unblock();},beforeSend:function(e){if(isMask)$('#div_mask').block({message: ''});}});
}

When requesting url synchronously or asynchronously in ajax , when responding to the returned request, there is a waiting process.
Copy code The code is as follows:

success:function(request){onSuccess(request,isMask );},error:function(e) {if(isMask)$('#div_mask').unblock();},beforeSend:function(e){if(isMask)
$('#div_mask') .block({message:''});}

1. What follows success here is Method ({onSuccess) removed after successfully returning the response.
2. Error is the method to adjust when there is an error (error: function(e) {if(isMask)$('#div_mask').unblock();}). unblock() is a method of jquery.blockUI.js, which turns off scrolling when an error occurs.
3. BeforeSend sends data when responding and starts calling the method $('#div_mask').block({message:''},
block is the method of jquery.blockUI.js, open the div for scrolling.
Rendering:
jquery.blockUI.js upload scrolling wait effect implementation ideas and code_jquery
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn