• 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;

                                        }

                 }

            });

  • 相关阅读:
    [Vue] Create Filters in Vue.js
    [Vue] Import component into page
    [Angular Form] ngModel and ngModelChange
    [Ramda] Convert a QueryString to an Object using Function Composition in Ramda
    [Vue] Use basic event handling in Vue
    [Ramda] Declaratively Map Data Transformations to Object Properties Using Ramda evolve
    Linux2.6内核--VFS层中和进程相关的数据结构
    [置顶] Firefox OS 学习——Gaia 编译分析
    ORACLE 索引概述
    【笔试&面试】C#的托管代码与非托管代码
  • 原文地址:https://www.cnblogs.com/rdchen/p/8034012.html
Copyright © 2020-2023  润新知