110,533
社区成员
发帖
与我相关
我的任务
分享
$.ajax({
type: 'POST',
url: 'api/login/UserLogin?LoginName=test&LoginPwd=123',
data: “”,
dataType: 'json',
async: false,
cache: false,
success: function (data, textStatus) {
$.ajax({
type: 'POST',
url: 'api/login/UserLogin',
data: { LoginName: "test", LoginPwd: "123" },
dataType: 'json',
async: false,
cache: false,
success: function (data, textStatus) {}
config.Routes.MapHttpRoute(
name: "Api_Get",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional, action = "Get" },
constraints: new { httpMethod = new HttpMethodConstraint("GET") }
);
config.Routes.MapHttpRoute(
name: "Api_Post",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional, action = "Post" },
constraints: new { httpMethod = new HttpMethodConstraint("POST") }
);
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}