[HttpPost]
public ActionResult SendaddressIndex()
{
if (Request.IsAjaxRequest())
{
int userid = (bmwdb.users.SingleOrDefault(u => u.name == HttpContext.User.Identity.Name)).id;
List<Sendaddress> addresslist = bmwdb.Sendaddress.Where(m => m.Userid == userid).ToList();
return PartialView("_SendaddressIndex", addresslist);
}
returnnull;
}
能找到_SendadddressIndex这个局部视图,
局部视图也能执行
@model List< MvcApplication4.Models.Sendaddress>
@if (Model != null)
{
<p>收件地址列表:</p>
foreach (var address in Model)
{
@Html.RadioButton("address", false, false, new { id = @address.id }); <span>@address.adre @address.Zipcode</span><br />
}
}
这是js
function address() {
alert('123123');
$.ajax({
url: "/User/SendaddressIndex",
type: "POST",
success: function (data) {
alert(data);
$("#update").html(data);
},
error: function (msg) {
alert("error:"+ msg.responseText);
}
})
}
但是到最后msg报错
说是什么路径不对,找不到default.aspx。。。靠了,这到底怎么回事。。。
慕码人8056858
冉冉说
暮色呼如