Hi there,
I have a database driven website, which shows a list of files that have been uploaded by users.
I have a script called controller.php, which generates the HTML:
//excerpt
<?php foreach($uploads as $upload): ?>
<div class="upload">
<p><?php echo $upload['filename'] ?> |
<?php echo $upload['size'] ?> |
<?php echo $upload['type'] ?>
</p>
<form method="post" action="index.php">
<input type="hidden" name="id" value="<?php echo $upload['id'] ?>
<input type="submit" name="download" id="download" value="Download">
<input type="submit" name="delete" id="delete" value="Delete">
</div>
<?php endforeach; ?>
When the download button is clicked, the file is downloaded, and then deleted from the server, and the database entry is deleted.
All gravy so far, now I need to update the page, so that the downloaded/deleted item does not show on the page anymore.
So here’s my Jquery:
$(document).ready(function(){
$('#content').load('path/to/controller.php');
$('#download, #delete').click(function(){
$('#content').load('path/to/controller.php');
});
});
All works fine, until I re-load the controller.php script on the click event of ‘#download’, nothing changes.
I guess it could be for one of two reasons. Either a) I am reloading the script before the changes have been made to the database, or b) .load() doesn’t behave this way, and I should be approaching this problem a different angle.
Any assistance would be great.
Many thanks,
Mike