Here is the ASP MVC code in my view. It fires off to the controller and passes assetId and relationshipContext:
@Html.ActionLink("Archive", "Archive", new { assetId = Model.ID, relationshipContext = assetTypeRelation.RelationshipContextID }, new { @class = "btn btn-mini btn-warning", id = "btnArchive" })
I am wanting to utilize Ajax with this HTML.ActionLink, but am a bit confused. Here is the jQuery I have started with. Basically I just need this actionlink to pass assetId and relationshipContext to the Archive method in my assetcontroller.
$('#btnArchive').click(function(){
$.ajax({
url: '@Url.Action("Archive", "Archive")',
type: 'POST',
dataType: 'json',
data: {
assetId: $(this).attr("assetId"),
relationshipContext: $(this).attr("relationshipContext"),
},
success: function(){
alert("success")
},
error: function () {
alert("error")
},
});