How can I successfully pass a complete set model object through formdata and convert it to model type in the controller?
Here is my attempted solution:
JavaScript section:
model = {
EventFromDate: fromDate,
EventToDate: toDate,
ImageUrl: imgUrl,
HotNewsDesc: $("#txthtDescription").val().trim(),
};
formdata.append("model",model);
After passing it through AJAX, it ends up as a string. When checking the value of Request.Form["model"]
, it still remains a string with the value "[object object]"
.
Is there a better method to transmit a model through formdata and retrieve it in the controller?