ITPub博客

首页 > IT职业 > IT职场 > 使用jquery

使用jquery

IT职场 作者:jlwcb 时间:2021-09-09 10:03:41 0 删除 编辑

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();
     }

});


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


    

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4358/viewspace-2815731/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: angularJS-Ztree
请登录后发表评论 登录
全部评论

注册时间:2019-08-12

  • 博文量
    72
  • 访问量
    838