zoukankan      html  css  js  c++  java
  • Jquery EaseyUi 提交请求

    post 请求:

        function deleteActivity(){    

       var path = '<%=request.getContextPath()%>/activity/deleteActivity';    

       var rows = $('#dg').datagrid('getChecked');    

       if (rows.length > 0) {    

       $.messager.confirm('信息提示', '确定要删除活动么?', function(r) {      

        if (r) {      

           var ids = '';      

           for (var i = 0; i < rows.length; i++) {       

               ids += rows[i].id + ',';      

           }      

         ids = ids.substring(0, ids.length - 1);

           $.post(path, {       

            activityIds : ids      

              }, function(result) {       

         if (result>0) {      

           $.messager.show({ // show error message         

             title : '操作结果',         

             msg : '操作成功!'        

           });        

         $('#dg').datagrid('reload'); // reload the user data        

        } else {        

           $.messager.show({ // show error message         

           title : '操作结果',          

            msg : '操作失败!'        

         });        }       }, 'json');      }     });    } else {     $.messager.alert('警告', '至少选择一条记录!');    }   }

    AJAX 请求:

       var params = {};
       params.vehicleid=$("#vehicleid").val();

    $.ajax({
            type: "POST",
            url: path,
            async: false,
            data: params,
            dataType: "json",
            success: function(result){
            if (result.success){
                      $('#dg').datagrid('reload');
                      $('#distributeTaskW').window('close');
                      $.messager.alert('消息','操作成功!');
                      
                     } else {
                $.messager.alert('消息',result.error);
                         $('#distributeTaskW').window('close');
                     }
            }

      $.getJSON 请求

       var url = "<%=request.getContextPath()%>/customer/getUserInfoByMobile";
             var data = $.param({ "mobile": $("#mobile").val() });
             $.getJSON(url, data, function(result) {
                 var res = eval(result);
                 if (res.code == "10000" && res.data.id!=null) {
                     $(".trUserInfo").show();
                     $("#sCustomerName").text(res.data.name);
                     $("#customerId").val(res.data.id);
                 }else{
                  $(".trUserInfo").hide();
                  //$.messager.alert('消息提示',res.message,'info');
                  $.messager.alert('消息提示',"未找到当前用户信息或用户被禁用");
                 }
                
             });

    form 请求

        $('#fmEdit').form('submit',{
        url: '<%=request.getContextPath()%>/activity/saveActivity',
        onSubmit : function(param) {
        return $(this).form('validate');//ture校验通过 false 校验失败
        },
        success : function(result) {
         flag=false;
         if (result <= 0) {
          $.messager.alert('消息','保存失败!');
         } else {
          $.messager.alert('消息','保存成功!');
          search();
          $('#dlg_edit').window('close');
         }
        }
       });

  • 相关阅读:
    消息队列系列——启蒙(一)
    重新整理数据结构与算法(c#)—— 图的深度遍历和广度遍历[十一]
    重新整理数据结构与算法——八皇后问题解决[十]
    重新整理数据结构与算法——迷宫算法[九]
    重新整理数据结构与算法——逆波兰表达计算器[八]
    lowdb 在electron 使用中注意的问题
    apollo客户端springboot实战(四)
    apollo在liunx环境实战(三)
    apollo入门demo实战(二)
    设计模式总结
  • 原文地址:https://www.cnblogs.com/cuijinlong/p/6595287.html
Copyright © 2011-2022 走看看