To some extent I have figured out a way to hide the url. below is the jquery code: I have bound the click event to the a element....
var target = $(event.target);
if($(target).is("a"))
{
if ($(target).text() == "Delete")
{
var reg = $(this).find('.details input:first').val();
$.get(window.location + "?delete=true&id=" + reg);
}
}
The problem I am facing now is that sometimes the page updates itself to show the id that was deleted and sometimes even though the id was deleted, the page does not reflect the deletion until the page is refreshed using F5.
Also I thought the $.get would be an async ajax request, but it seems the whole page is hard refreshed (even though it seems useless because the id deleted is still shown on the page, again - goes away after the manual F5). I have just tried a lot of things using .load in the success, .ajax, .post etc etc, but I have the same issue.
Thanks,
Anoop
On Fri, Jul 31, 2009 at 1:20 AM, rupak mandal <rupaknitd@gmail.com> wrote:
Hi anoop I think you can store the required data in session.On Fri, Jul 31, 2009 at 5:19 AM, Anoop kumar V <anoopkumarv@gmail.com> wrote:
I have a menu, on which is a delete link. The URL of the link is quite plain: http://mysite.com?delete=true&id=123
(quite obvious I think that the request is to delete the id=123)
I wish to hide the destination URL in the browser from the user - so that it shows a harmless url like: http://mysite.com?# or similar. The reasons are more aesthetic than anything else. Also the other advantage is once the user clicks on the link, and then hits on refresh, the request gets posted again and because the id=123 has already been deleted, it will just generate an error.. Does that make sense?
I dont mind using ajax for this - but would love if I could get both options - ajax and non-ajax.
Thanks,
Anoop
No comments:
Post a Comment