Ne mogu da skontam šta mi znači prvi Ajax poziv,ja sam naveo skriptu koju pokrećem dok drugi predpostavljam treba bude backend skripta..
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<title>Sorting Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/aja...queryui/1.7.2/jquery-ui.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$("#namelist").sortable({
connectWith: '#deleteArea',
update: function(event, ui){
//Run this code whenever an item is dragged and dropped out of this list
var order = $(this).sortable('serialize');
$.ajax({
url: 'primjer.php',
type: 'POST',
data: order
});
}
});
$("#deleteArea").droppable({
accept: '#namelist > li',
hoverClass: 'dropAreaHover',
drop: function(event, ui) {
deleteImage(ui.draggable,ui.helper);
},
activeClass: 'dropAreaHover'
});
function deleteImage($draggable,$helper){
params = 'PID=' + $draggable.attr('id');
$.ajax({
url: 'deleteImage.php',
type: 'POST',
data: params
});
$helper.effect('transfer', { to: '#deleteArea', className: 'ui-effects-transfer' },500);
$draggable.remove();
}
});
</script>
<style type="text/css">
li { cursor: move; }
</style>
</head>
<body>
<?php
include'connect.php';
?>
<p>Drag and drop list items to sort them out</p>
<ul id="namelist">
<?php
$upit=mysql_query("SELECT * FROM dragdrop");
while($row=mysql_fetch_array($upit))
{?>
<li id='<?php echo $row['id'];?>'><img src="<?php echo $row['putanja'];?>"></li>
<?php
}
?>
</ul>
<div id="deleteArea">
Drag here to delete.
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<title>Sorting Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/aja...queryui/1.7.2/jquery-ui.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$("#namelist").sortable({
connectWith: '#deleteArea',
update: function(event, ui){
//Run this code whenever an item is dragged and dropped out of this list
var order = $(this).sortable('serialize');
$.ajax({
url: 'primjer.php',
type: 'POST',
data: order
});
}
});
$("#deleteArea").droppable({
accept: '#namelist > li',
hoverClass: 'dropAreaHover',
drop: function(event, ui) {
deleteImage(ui.draggable,ui.helper);
},
activeClass: 'dropAreaHover'
});
function deleteImage($draggable,$helper){
params = 'PID=' + $draggable.attr('id');
$.ajax({
url: 'deleteImage.php',
type: 'POST',
data: params
});
$helper.effect('transfer', { to: '#deleteArea', className: 'ui-effects-transfer' },500);
$draggable.remove();
}
});
</script>
<style type="text/css">
li { cursor: move; }
</style>
</head>
<body>
<?php
include'connect.php';
?>
<p>Drag and drop list items to sort them out</p>
<ul id="namelist">
<?php
$upit=mysql_query("SELECT * FROM dragdrop");
while($row=mysql_fetch_array($upit))
{?>
<li id='<?php echo $row['id'];?>'><img src="<?php echo $row['putanja'];?>"></li>
<?php
}
?>
</ul>
<div id="deleteArea">
Drag here to delete.
</div>
</body>
</html>
Code:
<?php
include'connect.php';
$id=$_POST['PID'];
$upit=mysql_query("DELETE * FROM dragdrop WHERE id='$id'");
?>
<?php
include'connect.php';
$id=$_POST['PID'];
$upit=mysql_query("DELETE * FROM dragdrop WHERE id='$id'");
?>