1,将jquery-showloading-plugin.zip中的index.js和style.css拷贝出来(可以自己再重新命名,例如:jquery.showLoading.js和showLoading.css),然后引入到需要的页面。


2,假如有以下这个容器:

<div id="view_container"></div>

该容器里面有一些按钮或者图表组件,当进行某些操作的时候,例如:服务器请求等,可以使用以下的代码:

jQuery("#view_container").showLoading() ;

$.ajax({
url: req.action',
type: 'post',
data: {name:'小张',age:'32'},
dataType: 'json',
success: function(json) {

jQuery("#view_container").hideLoading();

},

error:function(){
jQuery("#view_container").hideLoading();
}

});


好了,就这么简单,试试吧~



附件:http://down.51cto.com/data/2367101