Let's use a simple little petition form designed to innocently gather billions of passwords:
<form action="/Petition/Sign" method="post">
<input class="form-control password" id="Password" name="Password" type="password">
<button type="submit" class="btn loginBtn">Sign</button>
</form>
I would like to be signaled in JavaScript code (as Angular-esque as possible) within this view when a successful post has taken place for whatever reason, the most obvious the being the 'Sign' button being clicked, but that even is only the beginning of the event I want to catch the end of.
The most simple I can think of is to create and clear a hidden input on the button's ngClick
event, then poll for a fixed timeout until the value of that input is a constant one always expected back from POST
requests.
NOTE: This is a tiny example of a great horde of such forms and converting then all to use Ajax calls with signaled completions is only on the very remote side of feasible and further from desirable. Unlike in other such questions I f have asked, I have no interest directly measuring the success of the call.