首页 > 解决方案 > 单击后更改按钮 URL 操作

问题描述

好的,所以我有这个按钮:

<button name="nameButton" id="idButton" title="your title" class="btn btn-success" onclick="location.href='@Url.Action( "AddToCollection","UserCollection", new {  gameId = Model.Id })'; return false;"><i class="fa fa-heart"></i>Add To Collection</button>

我怎样才能改变

@Url.Action( "AddToCollection","UserCollection", new {  gameId = Model.Id}

让我们说

@Url.Action( "RemoveFromCollection","UserCollection", new {  gameId = Model.Id}

我搜索并无法弄清楚如何使用 jQuery 或 JavaScript 来做到这一点。

标签: javascriptc#jquerybuttonhref

解决方案


推荐阅读