Jquery.ajax发送参数调用.Net Mvc子方法返回一个子页面嵌入当前页
- 前端页面:
<div id='预留位置'>
</div>
$.ajax({
url: '@Url.Action("子方法")', //调用子方法(child action)
type: 'POST',
data: ({ 参数名称: 值 }), //注意括号
dataType: 'html', //返回html格式
success: function (result) { $('#预留位置').html(result); }
- 后端Control:
[HttpPost]
public ActionResult 子方法(string 参数名称)
{...}
- 后端 Child View:
<p>该干嘛干嘛</p>