AJAX: 对话框大全



javascript 复制代码
AJAX:
  $.ajax({
  url: "/admin/cutting/getDataWeek",
  type: "GET",
  data:{
  
        },
  dataType:'json',
  success: function (res) {
     if (res.code == 1) {

     }
   },
   error:function (error) {
      console.log('请求失败');
      console.log(error);
   }
 });      	

 $('.sub').unbind('click').click(function() {
    var id = $(this).data('id');
    swal({
      title: "确认完成后,数据将不可再修改?",
      type: "warning",
      showCancelButton: true,
      confirmButtonColor: "#DD6B55",
      confirmButtonText: "确认",
      showLoaderOnConfirm: true,
      cancelButtonText: "取消",
      preConfirm: function() {
        return new Promise(function(resolve) {
          $.ajax({
            method: 'post',
            url: '/admin/patfabric/checksuccess',
            data: {
              id:id,
              type:2,
              _token:LA.token,
            },
            success: function (data) {
               $.pjax.reload('#pjax-container');
               resolve(data);
            }
         });
       });
     }
   }).then(function(result) {
      var data = result.value;
      if (typeof data === 'object') {
        if (data.status) {
           swal(data.message, '', 'success');
        } else {
           swal(data.message, '', 'error');
      }
    }
  });
});	



 supplyCheck:function () {
  this.$confirm('确认审批通过, 是否继续?', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
     $.ajax({
        url:"/feed_check_store",
        data:{'_token':'{{ csrf_token() }}','user_id':this.user_id)},
        type:'POST',
        cache:false,
        dataType:'json',
        success: function (res) {
          location.reload();
        },
        error: function (xhr, textStatus, errorThrown) {
          }
        });
        this.$message({
           type: 'success',
           message: '审批通过!'
         });
       }).catch(() => {
        this.$message({
          type: 'info',
          message: '取消操作'
        });
      });
  },

 checkBack:function () {
    this.$prompt('请输入驳回原因', '提示', {
       confirmButtonText: '确定',
       cancelButtonText: '取消',
    }).then(({ value }) => {
      $.ajax({
         url:"/feed_check_store",
         data:{'_token':'{{ csrf_token() }}','user_id':this.user_id,'id':this.feed_id,'reject_remark': value},
               type:'POST',
               cache:false,
               dataType:'json',
               success: function (res) {
                 location.reload();
               },
               error: function (xhr, textStatus, errorThrown) {
               }
            });
            this.$message({
              type: 'success',
              message: '驳回完成!'
            });
         }).catch(() => {
           this.$message({
             type: 'info',
             message: '取消操作'
           });
                 // this.$notify({
                 //   title: '警告',
                 //   message: data.message,
                 //   type: 'warning'
                 // });

                 //this.$alert(res.msg, '提示', {
                 //       confirmButtonText: '确定',
                 //});

                 //sweetAlert(res.msg);

 		 //swal(data.msg, '', 'error');
         });
 },
相关推荐
侯六六10 分钟前
前端无感刷新Token实现(基于Axios)
前端
shadowcz00722 分钟前
Live Search API :给大模型装了一个“实时搜索引擎”的插件
linux·服务器·前端·数据库·搜索引擎
一个小白5551 小时前
nginx 的反向代理 负载均衡 动静分离 重写
linux·运维·前端·nginx·centos·firefox
panrunjun1 小时前
vue element-plus 集成多语言
前端·javascript·vue.js
蓝莓味的口香糖1 小时前
Vue常用自定义指令-积累的魅力【VUE】
前端·javascript·vue.js
未来之窗软件服务2 小时前
在 Excel 使用macro 常用函数 使用行数 招标专家系统————仙盟创梦IDE
前端·excel·vbs·excel插件·仙盟创梦ide
全马必破三2 小时前
前端性能优化方案
开发语言·前端·javascript
心海资源2 小时前
【心海资源】黄金首饰价格查询单页源码
前端·学习·开源软件
打小就很皮...2 小时前
《从虚拟 DOM 到 Diff 算法:深度解析前端高效更新的核心原理》-简版
前端·javascript·html
神仙别闹3 小时前
基于Java(SSM)+MySQL实现(Web)具有智能推荐功能的图书销售系统
java·前端·mysql