I am trying to use a partial to display a modal that previews changes to a form. I am very close to getting it right, and this link gets me super close. The thing I can't figure out is how to pass my updated model to the partial view. I can send the Model's data just fine, but it only sends the Model's initial data. Here is my chart controller:
[HttpGet]
public ActionResult PreviewLine(LineChart previewModel)
{
return PartialView(previewModel);
}
Should I be making this an HttpPost instead, to update the file?
And here is the modal and the button:
<div id="previewModal" class="modal hide fade in" data-url="@Url.Action("PreviewLine", "Charts")">
<div id="previewContatiner"></div>
</div>
<button type="button" class="btn btn-info" id="previewBtn">
Preview
</button>
I think it is supposed to generate more code when I call the following JQuery button (I am new to JQuery):
<script>
$(document).ready(function () {
$("previewBtn").click(function () {
var url = $("#previewModal").data("url");
$.get(url, function (data) {
$("previewContainer").html(data);
$("previewModal").modal("show");
});
});
});
</script>
If you look at the previous link, you can see that I have drawn largely from that. However, it seems like I am missing something obvious in my approach. It also seems like clicking on the button isn't generating the code or calling the controller like I hoped.