• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

写了一个js文件,函数加载进去了,但是里面的函数不执行,是什么原因

一个·用来处理json数据的js文件,传过来的json数据是
{"infos":[{"id":402881e9564b22f701564b251aef0001,"title":"火影","publishingTime":"2016-08-02 20:05:38.0","isEditable":"true"},{"id":402881e9565a7f3601565a86f0c30001,"title":"龙珠","publishingTime":"2016-08-05 19:46:48.0","isEditable":"true"},{"id":402881e9565a7f3601565a8720ac0002,"title":"哈哈","publishingTime":"2016-08-05 19:47:00.0","isEditable":"true"},{"id":402881e9565a7f3601565a87464b0003,"title":"海贼","publishingTime":"2016-08-05 19:47:10.0","isEditable":"true"},{"id":402881e9565a7f3601565a87b47c0004,"title":"海贼王","publishingTime":"2016-08-05 19:47:38.0","isEditable":"true"}],"pageBean":{"pageSize":5,"currentPage":1,"totalPage":1,"hasPrevious":false,"HasNext":false}}处理json数据的文件是
  var pageIndex = 1;//首页
        
        $(function () {
            
            
            ajaxGetListData(pageIndex);
        });
      

     //ajax获开列表
function ajaxGetListData(index) {
    $.ajax({
        url: "getFirstInfoList.action",
        type: "Post",
        data: "page=" + index,
        dataType: "json",
        success: function (data) {
            var htmlStr = "";
            htmlStr += "";
            htmlStr += "";
            htmlStr +=""
                        +"序号"

                        +"用户ID"
                        +"标题"

                        +"创建时间"
                        +"";
            htmlStr += "";
            htmlStr += "";
            for (var i = 0; i < data.infos.length; i++) {
                htmlStr += "";
                htmlStr += "" + (i+1) + ""
                   
                                + ""+ data.infos.id + ""
                                + ""+ data.infos.title+ ""

                                +""+ data.infos.publishingTime+ "";
                htmlStr += "";
            }
            if(data.infos.length==0){
                    htmlStr += ""+ '暂无记录' + "";
                    }
            htmlStr += "";
            htmlStr += "";
            htmlStr += "";
            htmlStr += "";
            htmlStr += "显示";
         
            htmlStr += "每页" + data.pageBean.pageSize + "条记录_共" + data.pageBean.totalPage+ "页_"+"当前第"+data.pageBean.currentPage+"页" + "
";
            htmlStr += "";
            htmlStr += "";
           
            if(data.pageBean.currentPage > 1){
                     htmlStr += "首    页   ";
            }else{
                    htmlStr += "首    页 &nbsp";
            }
            
            if((data.pageBean.currentPage - 1 ) > 0 ){
                    htmlStr +="上一页 &nbsp";
            }else{
                    htmlStr +="上一页 &nbsp";         
            }
            
            if((data.pageBean.currentPage+1) > data.pageBean.totalPage){
                     htmlStr += "下一页  ";
            }else{
                      htmlStr += "下一页  ";
            }
            if(data.pageBean.currentPage < data.pageBean.totalPage){
                    htmlStr += "尾    页   ";
            }else{
                    htmlStr += "尾    页 &nbsp";
            }
            
            htmlStr += " ";
            htmlStr += "";
            htmlStr += "";
            htmlStr += "";
            htmlStr += "";

            $("#divSearchResult").html(htmlStr);
        },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest);
                    alert(textStatus);
                    alert(errorThrown);
                }
    });

}
        //首页
        function GoToFirstPage() {
            pageIndex = 1;
            ajaxGetListData(pageIndex);
        }
        //上一页
        function GoToPrePage() {
            pageIndex -= 1;
            pageIndex = pageIndex >= 0 ? pageIndex : 0;
            ajaxGetListData(pageIndex);
        }
        //下一页
        function GoToNextPage() {
            if (pageIndex < parseInt($("#count").text())) {
                pageIndex += 1;
            }
                ajaxGetListData( pageIndex);
        }
        //尾页
        function GoToEndPage() {
            pageIndex = parseInt($("#count").text());
            ajaxGetListData(pageIndex);
        }
        //跳转
        function GoToAppointPage(e) {
            var page = $(e).prev().val();
            if (isNaN(page)) {
                alert("请输入数字!");
            }
            else {
                var tempPageIndex = pageIndex;//pageIndex==currentPage
                pageIndex = parseInt(page);
                if (pageIndex < 0 || pageIndex > parseInt($("#count").text())) {
                    pageIndex = tempPageIndex;
                    alert("请输入有效的页面范围!");
                }else {
                    ajaxGetListData(pageIndex);
                }
            }
        }
   
2016/10/12 23:53:24
放下 2016/10/12 23:53:24










       
       

       

       
       
       

               
           
            社区主页
       
       
                  
              
              
   
  
      
   
   
  
       


经过测试里面的函数就是不执行,有可能是什么原因

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与2

看看console报的什么错误?

使用道具 举报

从来就没有这么传data的。

使用道具 举报

发新帖

发布任务需求已有1031167位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!