$(document).ready(function() {
  if($('img.absentieprogress').length > 0)
    setInterval("absentie_verwerkt_check()", 5000);
});



function absentie_verwerkt_check()
{
  
  console.log('absentie check');
  

  if($('img.absentieprogress').length > 0)
  {
    var $url = '/ajax/absenties/';
    $('.absentieprogress').each(function(){
      var $imageid  = $(this).attr('rel');
      var $recordid = $imageid.replace('absopen',''); 
      
      $.ajax({
        cache: false,
        type: 'GET',
        dataType: 'json',
        url:  $url + $recordid,
        success: function ($data)
        {
          console.log($data);
          if($data.status == 0)
          {
            console.log('jo');
            $('[rel=absopen' + $data.recordid +']').fadeTo(500,0, function() { $(this).remove();});
            
            
          }
      
        }
      });
      
    });
    
  }
}


