I have written a page that utilizes jquery draggable. It effectively has about 160 div elements that can be dragged around a page to allocate "stall sites" for an upcoming fete. To deal with so many elements I have a small database table that has 4 columns, those being ID, LEFT, TOP and DETAILS Each Div has id="ID", and the Content="Details" The first 2 of 160+ lines generated by PHP and SQL look like
div class="drag" id="1" style="left: 10px; top: 10px;">FS01<ul><li class="posX"><li class="posY">div>
div class="drag" id="2" style="left: 60px; top: 10px;">FS01<ul><li class="posX"><li class="posY">div>
After the elements have been dragged I find their new positions with the following Javascript
drag: function(){
var offset = $(this).offset();
var xPos = offset.left;
var yPos = offset.top;
//var zID = " <?php echo $id ?> "; //This is what I want to do
$('.posX', this).text('x: ' + xPos);
$('.posY', this).text('y: ' + yPos);
}
What I can't do (and a Javascript person could do this in seconds) is grab the ID and turn it into a Jquery variable (let's call it zID). With a new ID, LEFT and TOP, I can feed them back into an updating PHP File to make the new positions persistent. I've got the database, the PHP, the HTML, the Jquery running draggable and retrieving the "new" positions (xPos & yPos) and the PHP/SQL to return them to the database, but what I cant do is tie the positions to the ID ... HELP PLEASE!!