Reputation: 10068
I have this:
@Ajax.ActionLink("PLUS", "VotePlus", "Forums", new {postId = Model.Id}, new AjaxOptions
{
UpdateTargetId = "votePlus",
InsertionMode = InsertionMode.Replace
},
new{@id="votePlus"}
)
It generates link that says "PLUS". Now, i have a controller action that returns null (I also tried with empty partialView with no result). I want this link to disappear when user clicks on it. How can I do that?
Edit: It appears that this whole thing doesn't want to work. I created span tag and wanted it to replace itself, but this ajax helper keeps redirecting me to controller action. :-/
Upvotes: 0
Views: 862
Reputation: 1820
A slightly different approach, try using OnSuccess callback of AjaxOptions to call a javascript function to hide the link and update span
@Ajax.ActionLink("PLUS", "VotePlus", "Forums", new {postId = Model.Id}, new AjaxOptions
{
OnSuccess = ‘onSuccessProc’
},
new{@id="votePlus"}
)
// in your javascript section
function onSuccessProc(respData){
// code to update span assuming server returns html
$(‘#id_of_span’).html(respData);
$(‘# votePlus’).hide();
};
Upvotes: 1