سوال: نحوه اجراي پارشيال ويو

ساخت وبلاگ

در سمت کنترولر یک Action بدینصورت تعریف کنید


[HttpGet]

public virtual ActionResult MyAction(errorMessage or viewModel)
{
retu PartialView("MyPartialView, model);
}


در سمت کلاینت بدینصورت

<script>

function GetPartial() {
$.ajax({
url: "@Url.Action("MyAction", "myController")",
dataType: "html",
type: "GET",
cache: false,
contentType: 'application/json; charset=utf-8',
data: {param:value},

success: function (response)
{
$("#MyPartialView").html(response);
}
});
}

</script>


MyPartialViewهم بارشل شما برای نمایش هست برنامه نویس...
ما را در سایت برنامه نویس دنبال می کنید

برچسب : نویسنده : محمد رضا جوادیان programers بازدید : 189 تاريخ : سه شنبه 12 دی 1396 ساعت: 1:43