black-cn
شنبه 16 آبان 1394, 22:08 عصر
درود
من میخوام یک Action رو بعد از ارسال اطلاعات با Ajax.Beginform ،رفرش کنم
@using (Ajax.BeginForm("Insert", "Home", new { id = id }, new AjaxOptions
{
HttpMethod = "Post",
InsertionMode = InsertionMode.InsertAfter,
OnSuccess = "OnSuccess",
LoadingElementId="loading",
}))
{
و
<div id="result">
@Html.Action("View", "Home", new { id = id });
</div>
و کد Ajax
<script type="text/javascript" language="javascript">
var id = $("#pid").val();
function OnSuccess(result) {
$.ajax({
url: '@Url.Action("View", "Home")',
dataType: 'html',
data: { 'id': id },
type: 'GET',
success: function (result) {
$("#result").html(result);
}
});
}
</script>
میشه بگین مشکل این کدها کجاس ؟
من میخوام یک Action رو بعد از ارسال اطلاعات با Ajax.Beginform ،رفرش کنم
@using (Ajax.BeginForm("Insert", "Home", new { id = id }, new AjaxOptions
{
HttpMethod = "Post",
InsertionMode = InsertionMode.InsertAfter,
OnSuccess = "OnSuccess",
LoadingElementId="loading",
}))
{
و
<div id="result">
@Html.Action("View", "Home", new { id = id });
</div>
و کد Ajax
<script type="text/javascript" language="javascript">
var id = $("#pid").val();
function OnSuccess(result) {
$.ajax({
url: '@Url.Action("View", "Home")',
dataType: 'html',
data: { 'id': id },
type: 'GET',
success: function (result) {
$("#result").html(result);
}
});
}
</script>
میشه بگین مشکل این کدها کجاس ؟