hi all,
i have a little script for a delete function with a link in php.
now the function works but the page refreshes.
because this will go in to a form.
[B]this is the code
[U][B]test.php
[code=php]<?php
include(‘pagina.js’);
include(‘connect_db.php’);
if(isset($_GET[‘delete’]))
{
$query = ‘DELETE FROM RequestLines WHERE RequestLineId = ‘.(int)$_GET[‘delete’];
$result = mysql_query($query);
}
$query = ‘SELECT * FROM RequestLines where RequestId =670 ‘;
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
{
echo ‘<div class=”record” id=”record-‘,$row[‘RequestLineId’],'”>
<a href=”?delete=’,$row[‘RequestLineId’],'” class=”delete”>verwijder</a>
<strong>’,$row[‘RequestLineId’],'</strong>
</div>’;
}
?>
[code=html]<input type=”text” valeu=””>
this is to check if the page refreshes.
[B][U]pagina.js
[CODE]$(document).ready(function() {
$(‘a.delete’).click(function(e) {
e.preventDefault();
var parent = $(this).parent();
$.ajax({
type: ‘get’,
url: ‘../test.php’,
data: ‘ajax=1&delete=’ + parent.attr(‘id’).replace(‘record-‘,”),
beforeSend: function() {
parent.animate({‘backgroundColor’:’#fb6c6c’},300);
},
success: function() {
parent.slideUp(300,function() {
parent.remove();
});
}
});
});
});
can someone help me out here ?