zoukankan      html  css  js  c++  java
  • jquery 之ajax,get,post异步请求简单代码模版

    $.get(                        "../cart/cart_list.do",

                                   "productId="+productId,

                                   function(data){

                                       alert(data);

                                   }

      );

    post

    $.post(  "../cart/cart_list.do",

                       "productId="+productId,

                         function(data){

                                       alert(data);

                                   }

             );

    Post与get的格式是一样的

    Ajax

    url=__ctx+"/maintenance/onceequipment/tdJxdEquipment/dialogGltxfsdSend.ht";

    var params ={

                                                                                        "ids":arrIds,

                                                                                        "id":id

                                                                     };

    $.ajax({

                     "url":url,

                     "type":"post",

                "async":true,

                "data":params,

                "dataType":"json",

                "success":function(data){

                          if(data=='true'){

                                                 $.ligerDialog.success("操作成功","提示信息", function(rtn) {

                                                           if(rtn){

                                                                    //刷新父类窗口

                                                                    try{

                                                                    getParentWindow().refreshLeftTree();

                                                                    }catch(e){}

                                                                    self.location=document.referrer;

                                                           }

                            });

                                        }else{

                                                 $.ligerDialog.err("提示信息","失败!","操作失败");

                                                 //刷新父类窗口

                                                 try{

                                                 getParentWindow().refreshLeftTree();

                                                 }catch(e){}

                          self.location=document.referrer;

                                        }

                 }

            });

  • 相关阅读:
    题解【LOJ10094】「一本通 3.5 练习 2」消息的传递
    Codeforces Round #644 (Div. 3) 题解
    题解【洛谷P3627】[APIO2009]抢掠计划
    HDU-4416 Good Article Good sentence 后缀自动机
    HDU-6274 Master of Sequence 数学+二分
    Codeforces 666E Forensic Examination 广义后缀自动机+线段树合并+树上倍增
    HDU-5955 Guessing the Dice Roll AC自动机+高斯消元
    Codeforces 1437G Death DBMS AC自动机
    Codeforces 1037H Security sam+线段树合并
    2020ICPC·小米 网络选拔赛第一场 E-Phone Network 线段树
  • 原文地址:https://www.cnblogs.com/rdchen/p/8034012.html
Copyright © 2011-2022 走看看