【发布时间】:2015-12-04 16:50:03
【问题描述】:
我在表格中显示合同和服务的列表,它们都有一个 ID。
当您单击合同或服务的单元格时,它应该会进入详细信息页面。我将 ContractId/ServiceID 保存在 id 属性中,如下所示:
<td class="TableCell" id="@ID">
Sometext
</td>
我在这里检索它:
var id = this.id;
// the following is an MVC thing, don't worry about it
var url = '@Url.Action("Details", "services", new { id = "__id__" })';
window.location.href = url.replace('__id__', id);
这一切都很好,但现在我想在表格单元格中保存另一个变量,如下所示:
<td class="TableCell" id="@ID" value="@Variable2">
SomeText
</td>
我知道这行不通,但是最好的方法是什么?使用id 属性传递变量是个好主意吗?
【问题讨论】:
标签: javascript html model-view-controller