Jump to content

refresh page after ajax request and after client-side removal of DOM element


Recommended Posts

How can i reload the page in this jquery function?

 

 $(document).ready(function(){        
$('table td a.delete3').click(function(){                
var del_id = $(this).parent().attr('id');        
var info = 'del_option_id=' + del_id;
if(confirm("Zeker dat je deze optie met id " + del_id + " wilt verwijderen?")){

$.ajax({
type: "POST",
url: "deleteActies.php",
data: info,
success: function(){
}
});
$(this).parent().remove();        
}
return false;
});
});

 

First the ajax call should be finished, then the element (an option belonging to a question) should be removed --> $(this).parent().remove() and then the page should be reloaded.

 

 

 

aha :)

 

i managed it, but the confirm alert won't work: probably something with the quotations...

 

$content .= '<a href="deleteActies.php?del_option_id='.$row_options['ID'].' onclick="javascript:return confirm("'.'Are you sure'.'")">'

Please remove the javascript: bit from the onclick event, it does not belong there at all.

 

In fact, the only use it had was ages ago, when people would use it in the href attribute to emulate the onclick event. Why, I still don't know. It was as redundant then as it is now.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.