title: How to distinguish between POST and PUT inside a form submit listener
body: <p>Consider a form with a single button of type &quot;submit&quot;:</p>
  <pre><code>&lt;button type=&quot;submit&quot; id=&quot;formSubmitButton&quot;&gt;Submit&lt;/button&gt;
  </code></pre>
  <p>When loading the page, I send a GET-request to my server, which will return an object that is used to fill out the form. If there is no object inside my server-side database, the form will be empty.
  I have attached an EventListener to my form, such that when the form is submitted, a POST request is send to my server. I only want to send a post request, however, when the form was initially empty (on loading the page). If it wasn't, I want to send a PUT request instead. And I don't want to introduce another button inside my form. Else, I assume, I could just send the POST/PUT requests upon clicking on either buttton. I just want the single button though.</p>
  <p>Does anyone know of a nice way to accomplish this?</p>