我将参数传递给@ Url.Action,如下所示:
function showHistory() { myId= $("#id").val(); //alert(myId); actionDialog.load("@Url.Action("ActionHistoryAjax",new {id = myId,sort = "abc"})",function () { actionDialog.dialog('open'); }); }
但是给出错误“myId在当前上下文中不存在”.
我怎么能传递变量?
function showHistory() { myId= $("#id").val(); //alert(myId); actionDialog.load("@Url.Action("ActionHistoryAjax",new {id = "_Id",sort = "abc"})".replace("_Id",DeviceID),function () { actionDialog.dialog('open'); }); }
解决方法
我用这个来解决它:
function showHistory() { myId= $("#id").val(); actionDialog.load("@Url.Action("ActionHistoryAjax",function () { actionDialog.dialog('open'); }); }