function delete_photo (photo_id) {
if(confirm('Are you sure you want to delete this photo?')){
$.post("http://www.domain.com/delphoto/"+ photo_id);
$("#"+ photo_id).fadeOut(500);
}
return false;
};
Codex wrote:
>
>
> Maybe I'm going about thewrong way, but this is what I'm trying to
> achieve:
>
> I have a page with thumbnails. Underneath each thumbnail there's a
> 'delete' link:
>
> # photo_id.')">Delete
>
> On click I would like to fire a confirmation message. Upon
> confirmation the image should be deleted for which I have made a
> function that's in 'main.js':
>
> function delete_photo (photo_id) {
> confirm('Are you sure you want to delete this photo?');
> $.post("http://www.domain.com/delphoto/"+ photo_id);
> $("#"+ photo_id).fadeOut(500);
> return false;
> };
>
> The post works, the photo gets deleted, but on cancel the deletion is
> also executed. I can see that how I've done it now is incorrect
> because yes, the $post is right behind the confirmation so it's
> logical it's being executed. But how do you do this the right way??
>
> Thanks in advance!!
>
>
>
--
View this message in context:
http://www.nabble.com/Delete-photo-on-confirm-tf4576687s27240.html#a13068479
Sent from the jQuery General Discussion mailing list archive at Nabble.com.