我有一個看起來像這樣使用jQuery的區域
<script type="text/javascript">
function clickView(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
$.ajax({
url: "/Jac/ViewCustomDetails",
data: { productId: dataItem.Id },
success: function (response) {
$("#details").html(response);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
document.write(xhr.responseText);
}
});
}
</script>
基本上這使得AJAX調用我的控制器來呈現一個動作一個jQuery click方法中呈現從操作HTML。
行動ViewCustomDetails
,這是內JacController
,並在區域內是這樣的:
public ActionResult ViewCustomDetails(int productId)
{
Detail model;
model = new Detail
{
Price = productId.ToString(),
Origin = productId.ToString()
};
return View(model);
}
當我點擊我的按鈕觸發關閉AJAX調用,我能闖進我的行動。然而,我在我看來,出現此錯誤
The view 'ViewCustomDetails' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Jac/ViewCustomDetails.aspx
~/Views/Jac/ViewCustomDetails.ascx
~/Views/Shared/ViewCustomDetails.aspx
~/Views/Shared/ViewCustomDetails.ascx
~/Views/Jac/ViewCustomDetails.cshtml
~/Views/Jac/ViewCustomDetails.vbhtml
~/Views/Shared/ViewCustomDetails.cshtml
~/Views/Shared/ViewCustomDetails.vbhtml
顯然,在我的觀點沒有這樣的控制器/操作的文件夾我的控制器是一個區域內。
如何獲取它以引用我所在地區的控制器?