I'm attempting to incorporate a view through Ajax, but I'm encountering some issues. My knowledge of Ajax is limited, but I am eager to learn. What could be the missing piece here, or am I completely off track with my approach?
foreach(ect...) {
<tr>
<td>
<a href="#" onclick="AjaxStoryClick(@item.Id)" style="color:dodgerblue; font-weight: bold">@item.Name</a>
<script type="text/javascript">
function AjaxStoryClick(storyid) {
$.ajax({
url: '@Url.Action("UserStoriesList", "Estimate")',
type: 'POST',
data: storyid,
success: function(result){
$('#stories').html(result);
}
});
}
</script>
Controller:
public ActionResult UserStoriesList(int id)
{
ActiveEpicId = id;
var userstories = userRepository.Select().Where(x => x.EpicId.Equals(id)).ToList();
return PartialView("UserStoriesList",userstories);
}