Asp.net Core MVC and loading gifs on button click
I've been looking all over the bings for a good way to do a loading gif on button click, and the AJAX stuff is very confusing to me. I'm new with MVC / .net Core coming from webforms, so I never did any ajax stuff before (and I'm not a real web developer at all).
What I currently have in my view is a button that does this:
<input type="submit" a class="btn btn-outline-primary" value="Transfer" formaction="Transfer" />
Then I have another button for a cancel command:
<input type="submit" a class="btn btn-outline-danger" value="Cancel" formaction="Cancel_Transfer" />
In my controller I then have a this for handling the button click:
[HttpPost] public IActionResult Transfer() { ///Does a bunch of stuff that works right but takes a really long time }
And theres a respective Cancel_Transfer method that works correctly as well. The issue I'm having a hard time wrapping my head around is how to get the submit button click interecepted by Ajax to turn on a loading gif, then pass on the formaction command. Ajax super confuses me, so I'm sure its just me, but if anyone could help me break this down it'd be super appreciated.
0 comments:
Post a Comment