开发者

Jquery variable not defined error

I use the following jquery statements but i get error in this

function onGetDataSuccess(result) {
Iteratejsondata(result);
$(document).ready(function() {
    $("#pager").pager({ pagenumber: 1, pagecount: 5, buttonClickCallback: PageClick });
});

PageClick = function(pageclickednumber) {
    $("#pager").pager(开发者_JAVA百科{ pagenumber: pageclickednumber, pagecount: 15, buttonClickCallback: PageClick });
    $("#ResultsDiv").html("Clicked Page " + pageclickednumber);
         }
    }         
}

Error:PageClick is not defined....


I believe the way you create the PageClick function it could be parsed after the other code or the PageClick variable is not in scope.

Try this:

 $(document).ready(function() {
        var PageClick = function(pageclickednumber) {
            $("#pager").pager({ pagenumber: pageclickednumber, pagecount: 15, buttonClickCallback: PageClick });
            $("#ResultsDiv").html("Clicked Page " + pageclickednumber);
        }

        $("#pager").pager({ pagenumber: 1, pagecount: 5, buttonClickCallback: PageClick });
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜