Reputation: 412
I have an application and I want to update the view when the success
event fires.
Thanks.
Controller C#
public ActionResult Oid(int Oid)
{
CustomerId = Oid;
var model = ordendao.CustomerOrder(Oid);
return PartialView("_TreeListOrdenesPartial", model);
}
returns a html response
Javascript code
function event(){
$.ajax({
url: '@Url.Action("Oid","Customer")',
data: JSON.stringify({ "Oid": customer[0]}),
type: 'POST',
contentType: 'application/json; charset=utf-8',
success: function (data) {
// return values
console.log("Sucess!" + data.oid);
},
error: function () { console.log('error!!'); }
});
}
Upvotes: 0
Views: 1819
Reputation: 25370
make a placeholder on your page, where you want the partialview to render:
<div id="treeListPartial"></div>
then in your ajax:
success: function (data) {
$("#treeListPartial").html(data);
},
Upvotes: 3