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');
         });
 },
相关推荐
Y42584 小时前
本地多语言切换具体操作代码
前端·javascript·vue.js
速易达网络7 小时前
Bootstrap 5 响应式网站首页模板
前端·bootstrap·html
etsuyou7 小时前
js前端this指向规则
开发语言·前端·javascript
lichong9517 小时前
Android studio 修改包名
android·java·前端·ide·android studio·大前端·大前端++
cai_huaer7 小时前
BugKu Web渗透之 cookiesWEB
前端·web安全
lichong9517 小时前
Git 检出到HEAD 再修改提交commit 会消失解决方案
java·前端·git·python·github·大前端·大前端++
友友马7 小时前
『 QT 』QT控件属性全解析 (一)
开发语言·前端·qt
不想上班只想要钱8 小时前
vue3+vite创建的项目,运行后没有 Network地址
前端·javascript·vue.js
流***陌8 小时前
手办盲盒抽赏小程序前端功能设计:兼顾收藏需求与抽赏乐趣
前端·小程序
岁月宁静9 小时前
在富文本编辑器中封装实用的 AI 写作助手功能
前端·vue.js·人工智能