stijn0713 Posted August 12, 2012 Share Posted August 12, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/266974-refresh-page-after-ajax-request-and-after-client-side-removal-of-dom-element/ Share on other sites More sharing options...
trq Posted August 12, 2012 Share Posted August 12, 2012 One major benefit to using Ajax is that you don't need to reload the page to change the data it contains. Why are you using Ajax in the first place if you intend to reload the page? Quote Link to comment https://forums.phpfreaks.com/topic/266974-refresh-page-after-ajax-request-and-after-client-side-removal-of-dom-element/#findComment-1368762 Share on other sites More sharing options...
stijn0713 Posted August 12, 2012 Author Share Posted August 12, 2012 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'.'")">' Quote Link to comment https://forums.phpfreaks.com/topic/266974-refresh-page-after-ajax-request-and-after-client-side-removal-of-dom-element/#findComment-1368767 Share on other sites More sharing options...
Christian F. Posted August 12, 2012 Share Posted August 12, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/266974-refresh-page-after-ajax-request-and-after-client-side-removal-of-dom-element/#findComment-1368814 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.