Pagination javascript error function not found resolved