$('.invoice_cancel').on('click',function(){

    var id=[];
    
    $('input:checkbox[name=invoice_shipcheck]:checked').each(function(i){
      id[i]=$(this).data('id');
    });
    
    if(id=="")
    {
      alert("Please Select any invoice !!!");
    }
    else{
		$.ajaxSetup({

		headers: {
			  'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
			} 
		  });
		   
			
		  $.ajax({ 
			url:url_invoicecancel,
			method:"POST",		   
			data:{
			  id:id,
			  'type':'json',
			  },
		  
			success:function(result)
			{
				var success="";
			  if(result){
				success=success+
				  '<p style="text-align:center;"><b>Invoice Canceled Successfully !!!</b></p>';
				  
			}else{
				success=success+
				  '<p style="text-align:center;"><b>Something went wrong while cancelling invoice !!!</b></p>';
			}

				  
				  $('#invoice_success').append(success);
				  $('#invoice_success').removeClass("hide");
				  
				  setTimeout(function(){
					location.reload();
				  }, 200);
			}
		  });
    }
 


});