jQuery,返回undefined,急急急,求助啊~

2017-08-27 09:00 出处:360java.com 作者:360java  阅读()
View Code 1 lt;div gt; 2 lt;h1 gt; 3 lt;b gt;短信列表lt;/bgt; lt;span gt;lt;/spangt; 4 lt;/h1gt; 5 lt;div gt; 6 lt;div gt; 7 lt;%--lt;div gt; 8 lt;t
jQuery,返回undefined,急急急,求助啊~View Code
 1 <div >
 2         <h1 >
 3             <b >短信列表</b> <span ></span>
 4         </h1>
 5         <div >
 6             <div >
 7                 <%--<div >
 8                     <table >
 9                         <tr>
10                             <td>
11                                 <input type="text" runat="server" />
12                             </td>
13                             <td>
14                                 <a type="" ><span><em>查询</em> </span></a>
15                             </td>
16                         </tr>
17                     </table>
18                 </div>--%>
19                 <table >
20                     <thead>
21                         <tr>
22                             <th >
23                                 序号
24                             </th>
25                             <th >
26                                 内容
27                             </th>
28                             <th >
29                                 创建时间
30                             </th>
31                             <th >
32                                 操作
33                             </th>
34                         </tr>
35                     </thead>
36                     <tbody>
37                     </tbody>
38                 </table>
39                 <div >
40                 </div>
41             </div>
42         </div>
43     </div>

这个上面是弹出层,

jQuery,返回undefined,急急急,求助啊~View Code
 <img src="/images/MemberMaimage.jpg" alt="" />
                    <a href="#name" class="xz_Message" style="color: Blue; font-family: 微软雅黑; font-size: 13px;">使用已保存的短信</a>

这个上面是按钮,

jQuery,返回undefined,急急急,求助啊~View Code
//总页数
var pageCountgoods = 0;
// 页数变量
var currentPageIndexgoods = 1;
//显示数据
function showPageListgoods(cPagegoods) {
    //前一页和最后一页需要
    currentPageIndexgoods = cPagegoods;
    $("#onSalegoods tbody").children("tr").remove();
    //alert("sdf");
    $.ajax({
        type: "POST",
        contentType: "application/json",
        url: "MemberMaintenance.aspx/GetMessageList",
        data: "{currentPagegoods:'" + cPagegoods + "'}",
        async: false,
        dataType: "json",
        cache: false,
        success: function (result) {           
            var list = result.d.List;
            //alert(list);
            pageCountgoods = result.d.PageCount;
            if (list != null) {
                var tdHtmlgoods1 = "<tr><td class='textC'>";
                var tdHtmlgoods2 = "</td><td>";
                var tdHtmlgoods3 = "</td><td>";
                var tdHtmlgoods4 = "</td><td class='textC'><a content='";
                var tdHtmlgoods5 = "' title='选择短信' class='icon16 iconHand j_addgoods w20'></a></td></tr>";
                $.each(list, function (i) {
                    appendgoodsStr = tdHtmlgoods1 + list[i].TemplateID + tdHtmlgoods2 + list[i].TemplateContent + tdHtmlgoods3 + list[i].Createtime + tdHtmlgoods4 + list[i].TemplateContent + tdHtmlgoods5;

                    $("#onSalegoods tbody").append(appendgoodsStr);
                }); //end $.each(list, function (i)
            } //end if(list != null)
        }, //end success: function (result)
        error: function (error) {
            alert('error:' + error);
        } //end error: function (error)

    }); //end $ajax

    //显示页数
    showPagergoods(pageCountgoods, cPagegoods);
} // end 显示数据

// 显示分页 pageCount:总页数 currentPageindex:当前页数
function showPagergoods(pageCountgoods, currentPageindexgoods) {

    var pageHtmlgoods = "";
    pageHtmlgoods += '<span class="fr mr10"><a class="page-icon iconFirst"></a><a class="page-icon iconBack"></a><span class="pagerIndex">';

    // 前半部分
    if (currentPageindexgoods < 6) {
        for (var i = 1; i < currentPageindexgoods; i++) {
            if (currentPageindexgoods != i) {
                pageHtmlgoods += "<a href='javascript:showPageListgoods(" + i + ");'>" + i + "</a>";
            } else {
                pageHtmlgoods += "<a class='on'>" + i + "</a>";
            }
        }
    }
    else {
        for (var i = currentPageindexgoods - 5; i < currentPageindexgoods; i++) {
            if (currentPageindexgoods != i) {
                pageHtmlgoods += "<a href='javascript:showPageListgoods(" + i + ");'>" + i + "</a>";
            } else {
                pageHtmlgoods += "<a class='on'>" + i + "</a>";
            }
        }
    }
    // 后半部分
    if (currentPageindexgoods < pageCountgoods - 5) {
        for (var i = currentPageindexgoods; i < currentPageindexgoods + 6; i++) {
            if (currentPageindexgoods != i) {
                pageHtmlgoods += "<a href='javascript:showPageListgoods(" + i + ");'>" + i + "</a>";
            } else {
                pageHtmlgoods += "<a class='on'>" + i + "</a>";
            }
        }
    }
    else {
        for (var i = currentPageindexgoods; i <= pageCountgoods; i++) {
            if (currentPageindexgoods != i) {
                pageHtmlgoods += "<a href='javascript:showPageListgoods(" + i + ");'>" + i + "</a>";
            } else {
                pageHtmlgoods += "<a class='on'>" + i + "</a>";
            }
        }
    }
    pageHtmlgoods += '</span><a class="page-icon iconNext">';
    pageHtmlgoods += ' </a><a class="page-icon iconLast"></a></span>';

    $("#searchPagergoods").html(pageHtmlgoods);

    var prepage = currentPageIndexgoods - 1 > 0 ? currentPageIndexgoods - 1 : 1;
    var nextpage = currentPageIndexgoods + 1 < pageCountgoods ? currentPageIndexgoods + 1 : pageCountgoods;
    if (prepage != pageCountgoods) {
        $(".iconNext,").click(function () {
            showPageListgoods(nextpage);
        });
        $(".iconLast").click(function () {
            showPageListgoods(pageCountgoods);
        });
    }
    if (currentPageIndexgoods != 1) {
        $(".iconBack,").click(function () {
            showPageListgoods(prepage);
        });
        $(".iconFirst").click(function () {
            showPageListgoods(1);
        });
    }

} //end 显示分页

//选择宝贝点击事件
$('#choosegoods').jqm({
    trigger: '.xz_Message',
    overlay: 60,
    overlayClass: 'whiteOverlay'
}).jqDrag('.jqDrag');
//$('.xz_Message').live('click', function () {
$('.xz_Message').click(function () {


    $('#choosegoods').jqmShow();
    //alert("sdsds");
    //显示数据
    showPageListgoods(1);
});   //end $('.chooseGoodsBtn').click(function () {


/*选择按钮点击事件*/
$('#onSalegoods .j_addgoods').live('click', function () {
    //$('#onSalegoods .j_addgoods').click(function () {
    //alert("dsd");
    var contentstr = $(this).attr('content');
    $('#MainContent_txtMessage').val(contentstr);
    $('#choosegoods').jqmHide();
});        //end $('#onSalegoods .j_addgoods').live('click', function () {

这个是JS代码,js分页代码,

现在是我点击按钮,弹出层,然后里面有分页,我冲数据库里取出数据返回LIST,

jQuery,返回undefined,急急急,求助啊~View Code
 /// <summary>
        /// 获取短信-短信列表
        /// gwd 2012.5.9-1513
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public static object GetMessageList(int currentPagegoods)
        {
            Moon_MessageTemplateBLL messageTemplateBLL = new Moon_MessageTemplateBLL();
            int pageSize = int.Parse(ConfigurationManager.AppSettings["JS_PageSize"]);
            //DataSet dss = new DataSet();
            //dss = messageTemplateBLL.GetPagedDataSetCustomerByNote(currentPagegoods, pageSize, out totalCountMessage);
            List<Moon_MessageTemplateEntity> dss = Moon_MessageTemplateBLL.GetPagedDataSetCustomerByNoteGWD(currentPagegoods, pageSize, out totalCountMessage);//.GetRecommendPageList(qList, currentPage, pageSize, out totalCount);
            
            double pageCount = Math.Ceiling((double)totalCountMessage / pageSize);

            return new { List = dss, PageCount = pageCount };
        }

这是获取LIst的方法,但是每次弹出层,里面时间这个字段,老是创建时间这个字段为undefined:

jQuery,返回undefined,急急急,求助啊~

jQuery,返回undefined,急急急,求助啊~

嗯,就是不出时间,字段也没错啊~~

< >
最佳答案

应该是你的result.d.List的数据中,创建日期不是Createtime或者没有这个属性。

jQuery,返回undefined,急急急,求助啊~View Code
 List<Moon_MessageTemplateEntity> dss = Moon_MessageTemplateBLL.GetPagedDataSetCustomerByNoteGWD(currentPagegoods, pageSize, out totalCountMessage);//.GetRecommendPageList(qList, currentPage, pageSize, out totalCount);
            
            double pageCount = Math.Ceiling((double)totalCountMessage / pageSize);

            return new { List = dss, PageCount = pageCount };

这个是用List集合获取的短信表,有CreateTime啊,可是分页的时候,返回就是Undefined

分享到:
本文标签: .NET技术, jQuery, Javascript, Web前端

相关文章

发表评论(共条评论)愿您的每句评论,都能给大家的生活添色彩,带来共鸣,带来思索,带来快乐。

Copyright (C) java学习 360java 360java.com, All Rights Reserved.

苏ICP备16022210号