Reputation: 31
After $.post it works ,but how do I load partial view here?
$.post(url, { sypplyerName: sName, PerTranChallanId: pChallanId, ChalPerchesTranCode: pTranCodeINCHAL, ChallaNo: challaNo, TaxAmount: taxAmount, TotalAmount: totalAmount }, function (json) {
$.notify("Update And Convert Challan Succesfully ", "success");
alert("OKKKKKKKKKKKK")
// From Here I want to load partial view
$.json("/Shared/PerchesChallan", function (respnse) {
$.show(@Html.Partial("PerchesChallan")).html();
return false
});
});
Upvotes: 0
Views: 164
Reputation: 6508
To load a partial view, you need to create an Action on your Controller that will return the rendered result.
Then use this code
$('#ContainerToLoad').load('@Url.Action("ActionName", "ControllerName")');
instead of
$.show(@Html.Partial("PerchesChallan")).html();
This answer also help you.
Upvotes: 1
Reputation: 5252
You can load a partial view (which has a controller action returning a PartialView response) like so:
The 'parent' view:
<div id="partial-panel"></div>
<script>
...
$.post("/mycontroller/_myview", data, function(response) {
$("#partial-panel").html(response);
});
...
</script>
The 'mycontroller' Controller:
[HttpPost]
public ActionResult _MyView([your params here]) {
//..do stuff
return PartialView();
}
The Partial View for _MyView
will just have your content in it.
Upvotes: 0