XF 1.3 Showing alert after post is successfully submitted (shown) on a thread

tonnyz

Member
Hi, I want to display an alert after my post is successfully posted and shown on the thread_view.

I tried these on my quick_reply template :

1. Adding showAlert class for my form

Code:
<div class="quickReply message">
  
    <xen:include template="message_user_info">
        <xen:map from="$visitor" to="$user" />
        <xen:set var="$isQuickReply">1</xen:set>
    </xen:include>


    <form action="{xen:escape $formAction, false}" method="post" class="showAlert AutoValidator blendedEditor" data-optInOut="OptIn" id="QuickReply">

2. Next, adding a piece of code beneath
Code:
<script>
$(document).ready(function() {
    $('.showAlert').submit(function() {
       alert('submitted!')
    });
});
</script>

The problem is : the script always runs right after the reply button is clicked, no matter whether the post is successfully posted or not while some causes may prevent the post from being shown (i.e. must wait for 20 seconds, etc)

How should I handle this so that the alert will only be shown right after the post submitted has successfully been shown on the thread ?

Thanks :)
 
Back
Top Bottom