I've been using empty hrefs (href="#") and allowing a jQuery click event to get the data from my controller and display it in a partial view.
However, I'd like to implement the jQuery Address plugin so the back button can be used. From what I can tell, I need to stop using empty hrefs. (I imagine it's also bad practice to have empty hrefs.)
My new link looks like this.
<a href="/Stop/Details/<%: item.StopID %>">
<div class="stopId"><%: item.StopID %></div>
</a>
But now instead of my jQuery click event capturing it, I'm getting redirected to /Stop/Details right away, which is not what I want since that's a partial view. How can I fix this?
Edit: I just realized that my title is not accurate to the question. Sorry about that. Will try to think of a more accurate title and change it.
Double edit: Also realized that a div shouldn't be nested in a link.
My click event is actually a live click. It looks something like this:
$(function () {
$(".stopId").live('click', function () {
var stopId = $(this).html()
$.post('<%= Url.Action("Details") %>',
{ id: stopd },
handleSuccess
);
});
});