![](/img/trans.png)
[英]Getting data from javascript function on to ASP.NET MVC Controller's Action Method
[英]Reload a page in javscript to a specific controller's Action Method with parameter in asp.net MVC
我一直在尝试在 JavaScript 中使用参数将页面重新加载到特定控制器的操作方法,但出现错误。
我的 output 在我使用时工作
window.location.reload(true);
但我想用 PARAM 的值重定向到控制器的操作方法,我正在尝试这个
// Gives me the value in a function
var supId = data.supplierId;
//redirects the page so the I can see the updated the data
window.location.reload= '@Url.Action("GetSupplier", "Supplier", new { supplierId = supId })';
但这对我也不起作用。
有人能告诉我该怎么做吗
提前致谢。
就这样试试
var supId = data.supplierId;
window.location.href = '/Supplier/GetSupplier/' + supId ;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.