resident
جمعه 11 اردیبهشت 1394, 21:42 عصر
سلام. چطور میشه مدل view رو با مقادیرش به کنترلر پاس دااد؟(با ajax)
کد ایجکس من اینطوره:
var model= $('#ReportForm').serialize();
$.ajax({
url: '@Url.Action("PersonReport", "Person")',
type: 'POST',
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(model) ,
success: function (data)
{ alert('done');
}
});
اکشن ام هم به این صورته:
[AllowAnonymous]
[HttpPost]
public ActionResult PersonReport(CommonPersonReport entityReport)
{ .... }
مشکل اینجاست که تو کد jquery ، مدل مقدار داره اما وقتی میره به اکشن model خالیه. مشکل کجاست؟؟؟
کد ایجکس من اینطوره:
var model= $('#ReportForm').serialize();
$.ajax({
url: '@Url.Action("PersonReport", "Person")',
type: 'POST',
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(model) ,
success: function (data)
{ alert('done');
}
});
اکشن ام هم به این صورته:
[AllowAnonymous]
[HttpPost]
public ActionResult PersonReport(CommonPersonReport entityReport)
{ .... }
مشکل اینجاست که تو کد jquery ، مدل مقدار داره اما وقتی میره به اکشن model خالیه. مشکل کجاست؟؟؟