0

I am building this edit function that will use the index value to will pass to a modal that can then dislay the record for users to edit. I have the index value being logged but I am not sure how to pass it to the modal window. Both pages are cshtml and I never did most on the front end. Any help would be great.

$(".references-list").on("click", ".edit-reference", function () {
            var index = $(this).data('index');
            console.log(index);

            getAjax("@Url.Action("Add", "References")", function (data, index)
            {
                $("#reference-modal .modal-body").html(data);
                $("#reference-modal").modal('show');
            });

            return false;
        });

Controller

[HttpGet]
public ActionResult Add()
{
    return PartialView();
}
Jefferson
  • 173
  • 2
  • 12
  • 32
  • Does this answer your question? [Passing data to a bootstrap modal](https://stackoverflow.com/questions/10626885/passing-data-to-a-bootstrap-modal) – mxmissile Mar 16 '20 at 15:03
  • You can also put your modal into a partial view, populate it in the controller, and return the modal already populated to the client – koolahman Mar 16 '20 at 15:17
  • I have a ActionResult Add() should I add one for Edit? – Jefferson Mar 16 '20 at 15:25
  • @pjcougz I have a Add.cshtml page but will that mean I need an Edit.cshtml page too? – Jefferson Mar 16 '20 at 15:42

0 Answers0