Gra*_*ton 2 asp.net-mvc jquery
我想我在JQuery和ASP.NET MVC中发现了一些非常奇怪的东西.
正如在这个问题中提到的,我有以下JQuery代码:
$(function() {
$("#username").click(function() {
$.getJSON("ViewRecord/GetSoftwareChoice", {username:'123'},
function(data) {
alert(data);
});
});
});
Run Code Online (Sandbox Code Playgroud)
ViewRecord是控制器,GetSoftwareChoice是动作方法.但为此生成的URl是
http://localhost/ViewRecord/ViewRecord/GetSoftwareChoice?username=123
Run Code Online (Sandbox Code Playgroud)
太神奇了,不是吗?
为什么会这样?
这是我的路线:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1814 次 |
| 最近记录: |