trying to use form.submit(event) handler to send form data with ajax based on following example.
jQuery AJAX submit form
But my Handler function does not seem to trigger at all, I have tried adding return false and various prevention of default behavior, but the form still get submitted to action file.
Javascript:
$('#formWebUI').submit(function(e) {
        e.preventDefault();
        e.stopPropagation();
        e.stopImmediatePropagation();
        let form = $(this);
        let url = form.attr('action');
        $.ajax({
               type: "POST",
               url: url,
               data: form.serialize(), // serializes the form's elements.
               success: function(data)
               {
                   ChangeLocation();
               }
             });
        return false;
    });
HTML
<form id="formWebUI" class="form-inline pb-5" action="/php/form_WebUI.php" method="POST">
      <div class="container">
        <div class="row">
          <div class="col-3 p-0">
            <div class="form-group">
              <input type="text" class="form-control w-100" id="alias" name="alias" placeholder="Alias">
            </div>
          </div>
          <div class="col-7 px-1">
            <div class="form-group">
              <input type="text" class="form-control w-100" id="text" name="text" placeholder="Text">
            </div>
          </div>
          <div class="col-2 p-0">
            <input type="submit" class="btn btn-secondary w-100" id="formWebUI" value="Add">
          </div>
        </div>
      </div>
    </form>
I have also tried the button to be of element button instead of input. Type of the element was always submit never button. I have tried alerting in javascript, but it seems that the handler is never called no matter what I do. Would be thankful for any advice.
 
    