I don’t receive an alert even though this successfully returns the model I’m requesting?
function editaddress(id) {
$.ajax({
type: "POST",
url: "/Address/Edit/" + id,
success: function (msg) {
alert(msg);
}
});
}
What is msg? I thought it was maybe a JSON object?? When I debug, /Address/Edit/1 returns View(address); but how can I read that object in my view? Do I need to make some other post?
The partial view with this script is a jQuery UI Dialog listing Addresses, and I want to popup another jQuery UI Dialog on top of it to edit the record clicked. So, I need to somehow read the returned model object. How do I do this?
Edit:
public ActionResult Edit(int id)
{
Address address = dc.Addresses.Where(x => x.AddressID == id).First();
return View(address);
}
Use firebug, console. That way yous can see the post you did, see the parameters you passed, and see the response that is returned.
The response will be your “msg” variable