Asp.net Core and Ajax Buttons
Working on an internal web app, and I am not a web guy. Ajax makes my brain hurt. Today we learn how to wire up a button to Ajax and make it do things. Also I’m super bad at blogging and just wanted to put this some where cause I just spent a long time figuring it out. First, we have to setup our foundation so we know what we’re talking about. Names slightly changed from my internal work code cause I have secrets. In this case we have a Controller Named “Project”, and an Action in that controller named “Project_Transfer”. That controller code goes a little something like this: [HttpPost] public IActionResult Project_Transfer() { /// A bunch of stuff it takes a while to do } We have a model that matches this that sets some variables, houses a method it uses and such, but those aren’t important right now. Next up we have to setup our View. @using (Html.BeginForm(“Project_Transfer”, “Project”, FormMethod.Post, new { encType = “multipart/form-data”, id = “myform”, name = “my...