Example – On button click
$('#btn').click(function () {
var flag = false;
var b;
$.ajax({
type: 'GET',
url: '/Test/PV1/' + $('#Elements').val(),
data: null,
success: function (data) {
alert(data.pageID);
}
});
return false;
});
In the controller
public ActionResult PV1(int id)
{
//-- here i need to make a call to the partial view as well as return the pageID to the main view
}
Is it possible to make a call to a partial view from the main view at the same time return JSON (ID) back to the main view
You could bubble the event up from your partial to your parent (although its not usually considered best practice).
ie.
In your parent, have a function to set the ID to something.
Then in your partial, onSuccess, call that function.
eg.
Parent View
Partial View
});