The Head
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"> </script>
The HTML
<div id=info></div>
<div id="tousarticles">
<div class="titre" id="listitem_4">
<p>Blahblahblah</p>
</div>
<div class="titre" id="listitem_59">
<p>Blahblahblah</p>
</div>
<div class="titre" id="listitem_58">
<p>Blahblahblah</p>
</div>
<div class="titre" id="listitem_71">
<p>Blahblahblah</p>
</div>
</div>
The Javascript
<script type="text/javascript">
$(document).ready(function() {
$("#tousarticles").sortable({
opacity: 0.6,
axis: 'y',
update : function () {
var order = $('#tousarticles').sortable('serialize');
alert(order); // It alerts "listitem[]=59&listitem[]=4&listitem[]=58&listitem[]=71"
$("#info").load("test.php?"+order, function() {
alert( "Load was performed." ); // It alerts "Load was performed."
});
}
});
});
</script>
And the php
<?php
$fp = fopen("./upload/file.txt","w+");
// Normaly, the DB entry php script but, here, I put some stuff visible on a writable repertory on my server to know if it runs.
?>
The sortable interface works well: I can change the place of the DIV "listitems" without problem. But the test.php doesn't load at all.
Here is the process
I change the first paragraph with the second and the first alert comes with the correct string (listitem[]=59&listitem[]=4&listitem[]=58&listitem[]=71).I click "OK".
So, as expected, the second alert comes with "Load was performed." I click "OK".
However, the test.php script did'nt load.
The alert "Load was performed." comes even if the file does'nt exist (testtt.php for example).
Going to my server via ftp, there is no file /upload/file.txt. But the test.php runs well and creates an "upload/file.txt" when launched via url.