$(document).ready(function(){
$("#form_alpha").validationEngine({
	ajaxSubmit: true,  scroll: false
});
	
	$("#form_alpha").submit(function() {
	if ($("#form_alpha").validationEngine({returnIsValid:true})==true) 
      {
		$("#flash").show();
		$("#flash").fadeIn(400).html('<img src="ajax.gif" align="left"><span class="loading">Enregistrement en cours...</span>');

	var nom  = $('#nom').attr('value');  
	var code = $('#code').attr('value'); 
	$.ajax({
	type: "POST",
	url: "add.php",
	cache:false,
	data : "nom="+ nom +"&code="+code,
	success:function(html){
		
			$("ol#update").empty();
			$("ol#update").append(html);
			$("ol#update li:first").slideDown("slow");
			$("#flash").hide();
	},
	error:function(XMLHttpRequest,textStatus,errorThrown){
	}
	
	})
		  }
	  
	  });
	
function loadLog(){	

$.ajax({
	type: "POST",
	url: "affichage.php",
	cache:false,
	success:function(html){
			$("ol#update").empty();
			$("ol#update").append(html);
	},
	error:function(XMLHttpRequest,textStatus,errorThrown){
	}
	
	})
}
	//change ici le temps de rafrichissement de la table... c'est en miliseconde.. j'ai mis 5 min 
setInterval (loadLog, 300000);
});
