how to pass parameter to partial view in MVC4 razor
- by user2139492
In my asp.net mvc 4 application i want to pass a parameter to partial view,however the parameter we want to pass is coming from javascript code
Below is the code
<script>
var TestId;
$(document).ready(function () {
// Send an AJAX request
$.getJSON("/api//GetFun?Id="[email protected],
function (data) {
TestId= data.Id
//i am getting the id here which i need to pass in partial view
}
1)...........
});
</script>
html code:
<div id="tab1" >
2).... @{ Html.RenderAction("MyPartialView", "MyController", new { id = TestId });}
</div>
So let me know how can i pass the test id to my partial view :in HTML(2) code or in javascript (1)