zoukankan      html  css  js  c++  java
  • jquery遍历数组添加行删除行

    <script language="javascript" type="text/javascript">

    function queryInfo() {
    var membercode = $('#membercode').val();
    if(''== $.trim(membercode)){
    alert('请填写会员编号!');
    return false;
    }
    removeTr();
    var formUrl = '${rc.contextPath}/debitLimitMgt/queryList.htm?method=queryList';
    $.ajax({
    url : formUrl,
    type : 'POST',
    dataType : 'json',
    data : {'membercode': membercode},
    async : false,
    success : function(returnMsg) {
    addTr(returnMsg);
    },
    error: function(jqXHR, textStatus, errorMsg){
    alert("请求失败:" + errorMsg);
    }
    });
    }

    function removeTr(){
    var rows=$("#dataList").find("tr").length;
    if(rows>1){
    for(var i=1;i<rows;i++){
    $("#dataList tr").eq(i).remove();
    }
    }
    }

    function addTr(data){
    $.each(data,function(i,obj){
    var trHtml = '<tr><td>'+obj.membercode+'</td><td>'+obj.memberName+'</td><td>'+
    obj.idContent+'</td><td>'+obj.memberType+'</td><td>'+
    obj.openDebit+'</td><td>'+obj.singleLimit+'</td><td>'+
    obj.batchLimit+'</td><td>'+obj.filterNum+'</td><td><tr>';
    $("#dataList tr:last").after(trHtml);
    })
    }
    </script>

  • 相关阅读:
    BZOJ3282 Tree
    [NOI2004] 郁闷的出纳员
    [HNOI2004]宠物收养所
    [HNOI2002] 营业额统计
    图论 简单学习笔记
    POJ3321 Apple tree
    [国家集训队] 聪聪可可
    POJ2976 Dropping tests
    SCOI2005 最大子矩阵
    codeforces|CF13C Sequence
  • 原文地址:https://www.cnblogs.com/csk-1/p/7799673.html
Copyright © 2011-2022 走看看