I have a function CreatePerson(int id) , I want to pass id from @Url.Action.
Below is the reference code:
pub
If you are using Url.Action inside JavaScript then you can
var personId="someId";
$.ajax({
type: 'POST',
url: '@Url.Action("CreatePerson", "Person")',
dataType: 'html',
data: ({
//insert your parameters to pass to controller
id: personId
}),
success: function() {
alert("Successfully posted!");
}
});