'jquery form submit can't handle success/error notifications

I want to show a success notification if the submit was successful with this js notify library but it's doesn't works.

If I change the new Notify({ ... }) function to a simple alert("success"); then the alert is showing up...

But if I insert the same js code in the browser's Console then it's showing the notify ...

<form action="" method="post">
    <div class="form-group">
        <label for="title"><h6>Title</h6></label>
        <input type="text" class="form-control" name="title" id="title">
    </div>
    <div class="form-group">
        <label for="content"><h6>Content</h6></label>
        <textarea class="form-control" id="content" name="content"></textarea>
    </div>
    <div class="form-group">
        <button type="submit" class="btn btn-primary" id="edit">Save</button>
    </div>
</form>
<script>
 $("#edit").click(function() {

     var title = $("#title").val();
     var content = $("#content").val();
     $.ajax({
         type: "POST",
         url: "edit.php",
         data: {
            title: title,
            content: content
         },
         cache: false,
         success: function(data) {
            new Notify({
                status: 'success',
                title: 'Test',
                text: 'Success',
                effect: 'fade',
                speed: 300,
                customClass: null,
                customIcon: null,
                showIcon: true,
                showCloseButton: true,
                autoclose: false,
                autotimeout: 3000,
                gap: 20,
                distance: 20,
                type: 1,
                position: 'right top'
            })
         },
         error: function(xhr, status, error) {
             console.error(xhr);
         }
     });
      
});
</script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/simple-notify.min.css" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/simple-notify.min.js"></script>


Solution 1:[1]

The docs say that the x values must be monotonically increasing. Yours don't.

The x-coordinate sequence is expected to be increasing, but this is not explicitly enforced. However, if the sequence xp is non-increasing, interpolation results are meaningless.

Note that, since NaN is unsortable, xp also cannot contain NaNs.

A simple check for xp being strictly increasing is:

np.all(np.diff(xp) > 0)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 timgeb