Jump to content

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


stijn0713

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.