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');
         });
 },
相关推荐
MrSkye1 分钟前
🔥JavaScript 入门必知:代码如何运行、变量提升与 let/const🔥
前端·javascript·面试
白瓷梅子汤5 分钟前
跟着官方示例学习 @tanStack-form --- Linked Fields
前端·react.js
爱学习的茄子9 分钟前
深入理解JavaScript闭包:从入门到精通的实战指南
前端·javascript·面试
zhanshuo40 分钟前
不依赖框架,如何用 JS 实现一个完整的前端路由系统
前端·javascript·html
火柴盒zhang41 分钟前
websheet在线电子表格(spreadsheet)在集团型企业财务报表中的应用
前端·html·报表·合并·spreadsheet·websheet·集团财务
khalil43 分钟前
基于 Vue3实现一款简历生成工具
前端·vue.js
拾光拾趣录1 小时前
浏览器对队头阻塞问题的深度优化策略
前端·浏览器
用户8122199367221 小时前
[已完结]后端开发必备高阶技能--自研企业级网关组件(Netty+Nacos+Disruptor)
前端
万少1 小时前
2025中了 聊一聊程序员为什么都要做自己的产品
前端·harmonyos
abigale033 小时前
webpack+vite前端构建工具 -11实战中的配置技巧
前端·webpack·node.js