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 });
});
精彩评论