<?php

?>



<html>
    <head>
 
		<link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
		<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
		<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

 
        <title>Demo</title>
    </head>
    <body>
        <button id="click_me">Click Me!</button>
    </body>
</html>


<script type="text/javascript">
    $(document).ready(function(){
        $('#click_me').click(function(){
           
			
			
					$( "#win" ).dialog({
					modal: true,
					title: "Renomer",
					buttons: {
								Valider: function()
								{
									$( this ).dialog( "close" );
									renomer();
								},
								Non: function()
								{
									$( this ).dialog( "close" );
								}
							 }
					});
			
			
        });
    });
	
	
function renomer()
{
	fichier = document.getElementById('nouveau_nom').value;
	alert(fichier);
	
	    
        $.ajax({
            url: "traitement_fichier.php", // our php file
            type: 'post',
            data: 'element=' + fichier,
            dataType: 'html', 
            success: function (response) {
			alert(response);
				document.getElementById('message').innerHTML = response;
            },
            error : function(request) {
                console.log(request.responseText);
            }
        }); 
}
	
</script>

<?php
	$nom_fichier = "biloute.txt";
	
	$_SESSION['utilisateur'] = "Utilisateurs";
	
?>

<div id="win"  style="display: none">
<form>
    <label><?php echo $nom_fichier; ?></label>
	
    <br/>
	<br/>
	<label>Nouveau nom: </label>
    <input type="text" name="nouveau_nom" id="nouveau_nom" />
	<br/>
	<br/>
   
</form>
</div>

<div id="message"  >
</div>
