could you please check if this the right code to do what I pretend? I just want to click on a button, delete the record and return to the same page where I was before. The following sample is working on IE9 and Chrome, but not on IE8.
I´ve got a table with rows, inside a DIV (#page_content). At the end of each row I have a button that allows to delete that record. The button code is the following:
<a class="delete" href="pages/roomwizard/roomwizard_delete.asp?id=<%=Rs("id")%>"><img src="images/delete.png" title="Delete record"/></a>
The delete function is:
$.ajaxSetup({ cache: false }); // it does the job!!!
$('#page_content .delete').click(function (e) {
e.preventDefault();
var url_delete = $(this).attr('href');
$.post(url_delete);
$('#content').load(url_back); // main div, with #page_content inside
});
As I said, in IE9 and Chrome is working. I don´t know if this is the right way to do it. In IE8, when the button is clicked it still works, but it opens a blank page or stays at the same page (with preventDefault).