The problem here is that page at alert has the final value of i.. any solution to this?
  for(var i=start;i<=end;i++)
            {
                num=pageNumber.clone();
                num.click(function(event)
                {
                    event.preventDefault();
                    var page=i;
                   alert(page);
                   // drawPager();
                });
                num.find("span").text(i);
                if(i==curPage) {
                    num.find("span").addClass("current");
                    num=num.find("span");
                }
                $("#pager>div").append(num);
            }
 
     
    