如何在输入字段中存储和读取任意 url
how to store & read arbitrary url inside Input field
我的 asp.net mvc 视图中有以下内容:-
<input type="submit" id="addswitch" data-targeturl="@Url.Action("showSwitches","Rack")" class="btn btn-small btn-primary" value="Add">
我的想法是我需要存储真实的 URL insdie 一个任意值,我将其命名为 data-targeturl。
然后在我的脚本中,当用户点击上面的输入字段时将触发如下:-
$('body').on("click", "#addserver,#addsd,#addfirewall,#addrouter,#addswitch", function () {
$("#showAddDialog").dialog({
title: "Add Exsisting " + dialogtitle,
width: 'auto', // overcomes width:'auto' and maxWidth bug
maxWidth: 600,
height: 'auto',
modal: true,
fluid: true, //new option
resizable: false
});
var URL = this.data-targeturl;
但目前我收到以下错误:-
ReferenceError: targeturl is not defined
var URL = this.data-targeturl;
我的 asp.net mvc 视图中有以下内容:-
<input type="submit" id="addswitch" data-targeturl="@Url.Action("showSwitches","Rack")" class="btn btn-small btn-primary" value="Add">
我的想法是我需要存储真实的 URL insdie 一个任意值,我将其命名为 data-targeturl。
然后在我的脚本中,当用户点击上面的输入字段时将触发如下:-
$('body').on("click", "#addserver,#addsd,#addfirewall,#addrouter,#addswitch", function () {
$("#showAddDialog").dialog({
title: "Add Exsisting " + dialogtitle,
width: 'auto', // overcomes width:'auto' and maxWidth bug
maxWidth: 600,
height: 'auto',
modal: true,
fluid: true, //new option
resizable: false
});
var URL = this.data-targeturl;
但目前我收到以下错误:-
ReferenceError: targeturl is not defined
var URL = this.data-targeturl;