I have an anchor tag which when clicked seems to scroll to the top of the screen.
I am using onclick and sending a model property to the function.
How can i prevent scrolling to top.
I have tried entering the href as javascript:void(0); and tried returning false.
<a href="javascript:void(0);" onclick="GetUsers('@(user.Code)');"><img ... /></a>
function GetUsers(Code) {
$.ajax({
...
});
}
Update
Tried debugging it and it doesn't get to this line.
var user = $(this).data('user-code');
Also no errors on page.
$.ajax({
type: "GET",
url: "/Admin/GetUsers/",
data: { "User": user},
success: function (data, textStatus) { ...
Doesn't get to this point...
Update
Now getting all the information, although the scrolling is still an issue. The prevent default doesn't seem to make any difference.