var total_date=0;
var selected_district=0;


$('#district_select').on('change',function(e){
    e.preventDefault()
    selected_district=$(this).val();
    
    $.ajax({
        type: "GET",
        url: 'block_data',
        data: {search:search},
        dataType: "json",
        success: function (result) {

            if (result.msgType == true) {
              $('#no_distict').hide();
               $('#district_d').show();
                
                
                var total=result.data;
                var no_of_pages= Math.ceil(total/max);
                if(no_of_pages!=0) {
                    if (currentPage > no_of_pages) {
                        currentPage = no_of_pages;
                    }
                }
                console.info("total:"+total+" no_of_pages:"+no_of_pages+" currentPage:"+currentPage);
                if(total >0){
                    if(offset==total){
                        offset=offset-max;
                    }
                    paginateTab(no_of_pages,max);
                    list(search,max,offset);
                }else{
                    $('#no_distict').show();
                    $('#district_d').hide();
                }


            }else {
              $('#no_distict').show();
              $('#district_d').hide();
            }

        },
        error: function (jqXHR, textStatus, errorThrown) {

            callAjaxErrorFunction(jqXHR, textStatus, errorThrown);
        },
        complete: function (data){
            /*$(".se-pre-con").fadeOut("slow");*/
        }
    }); 
})