jQuery的 - Url.Action本地机器Pathing的问题 [英] jQuery - Url.Action LOCAL Machine Pathing Issue
问题描述
为什么只在我的本地机器需要我具备以下条件:
Why would only my local machine require me to have the following:
$.post('@Url.Action("ControllerName/ActionName")', { param: valueHere }, function (result) { successFunc(result); }).fail(function (error) { alert(error); });
而在其他计算机上,这将是正常的:
While on other computers it would be the normal:
$.post('@Url.Action("ActionName")', { param: valueHere }, function (result) { successFunc(result); }).fail(function (error) { alert(error); });
这不会对我有问题的电脑工作:
This does not work for my computer in question:
$.post('@Url.Action("ActionName", "ControllerName")', { param: valueHere }, function (result) { successFunc(result); }).fail(function (error) { alert(error); });
我试图弄清楚为什么它并不适合我的电脑之一,不是所有的人唯一的工作。
I'm trying to figure out why it's not working only for one of my computers and not all of them.
所以,有4台电脑3将只与 ActionName
运行,而只有一个只会用 ControllerName / ActionName
运行。可能是什么可能出现的问题?
So, having 4 computers 3 will only run with ActionName
while only one will only run with ControllerName/ActionName
. What could be possible problem?
感谢您的时间。
编辑1:仍然有同样的问题,甚至与第一个答案。请参阅评论。
Edit 1: Still having the same problem even with first answer. Please see comment.
推荐答案
使用:
@Url.Action("actionName", "controllerName")
问题可能是由控制器名称,以便更好更具体的差异造成的。
The issue is probably caused by a discrepancy in the controller name so it is better to be more specific.
这篇关于jQuery的 - Url.Action本地机器Pathing的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!