I have included the following lines of code where the result within the success function contains the necessary data in the form of [object Object] (Consider result has the attributes such as Name, Category and Description in the form of [object Object]).
$.ajax({
url: rootUrl + 'Admin/EditRSS',
type: "GET",
data: { FeedId: FeedId },
dataType: 'json',
success: function (result) {
// do something here
},
error: function () { alert("error") }
});
Now I want to use this result in a jquery dialog box which loads a partial view
$("#editFeedDialog").dialog({
title: "Edit Feed",
width: '60%'
});
<div id="editFeedDialog" style="display: none; background-color: aliceblue;" >
@Html.Partial("EditFeed",//pass result as model)
</div>
Controller
[HttpGet]
public ActionResult EditFeed(int FeedId)
{
using (DbContext dataContext = new DbContext())
{
var feedDetails = (from u in DataContext.FeedMaster
where u.FeedMasterId == FeedId
select u).FirstOrDefault();
FeedMaster r = new FeedMaster();
r.FeedMasterId = FeedId;
r.FeedName = feedDetails.FeedName;
r.FeedCategory = feedDetails.FeedCategory;
r.FeedDescription = feedDetails.FeedDescription;
return Json(r, JsonRequestBehavior.AllowGet);
}
}
Either I should be able to pass it as a model to my partial view or at least I should be able to use it within the I am new to ajax. So can anyone help me out with this?
result.Name
result.Category
result.Description
@ParthTrivedi – pallavi Sep 13 '16 at 13:01