I have the following jQuery code in a View in MVC3. I want to load a partial view (named OffshoreECore) in a div (#Form) depending on the JSON object passed in the success function. Here’s the code:
var inputParamtrs = { 'HeadId': $('#ExpenseId').val(), MProjid': $('#MProjid').val() };
$.ajax({
type: "POST",
url: "/Expenses/Edit",
data: inputParamtrs,
success: function (json) {
('#Form').load('@Url.Action("OffShoreECore", *What comes here ?!?*)');
}
Thanks.
The second parameter of
load()is thedatawhich should be sent to the specified URL along with the request. To send your JSON string, try this:You example code is also missing a
'delimiter from the second key ininputParamtrsand the$from the selector insuccess, but I guess they’re just typos.