赞
踩
- public IActionResult Index()
- {
- return RedirectToAction("Index", "Main");//重定向=>Main/Index
- }
【备注】如果在MainController的Index方法中return View();本质是 return View("Index"),返回和方法同名的cshtml位置,即返回Main/Index.cshtml的页面;
需要用[FromBody]来接收
- $.ajax({
- url: '@Url.Action("ProcessStudent", "Main")',//将发送一个POST请求到MainController的ProcessStudent方法中
- type: 'POST',
- contentType: 'application/json',
- data: JSON.stringify(allStudents),//JSON格式发送
- success: function (response) {
- alert('后端成功响应: ' + response);
- },
- error: function () {
- alert('Error: 后端没有回复');
- }
- });
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。