Add custom ajax command to ajax response after webform is submitted What I'm trying to do is to invoke some javascript after a webform is successfully submitted by ajax.  

To do that I followed this advice and created an EventSubscriber to intercept ajax response and add my custom command there. The problem is that on some reason I can't check if the webform is submitted (data are sent) or not. 

  public function onResponse(FilterResponseEvent $event) {
    if($event-&gt;getResponse() instanceof WebformSubmissionAjaxResponse &amp;&amp;
       $event-&gt;getResponse()-&gt;getWebformSubmission()-&gt;isCompleted()) {
         $event-&gt;getResponse()-&gt;addCommand(new MyCustomCommand());
    }
  }


The problem is in isCompleted() method which always returns false on some reason. Actually I checked other methods from WebformSubmissionInterface and in this my event subscriber this WebformSubmission entity always looks empty (getters return nothing) and geState() always returns "STATE_UNSAVED" not depending if a webform is successfully sent of failed on validation.

What I'm missing? Is anything I'm doing wrong here? Or maybe are there any other method to achive same goal?
I had this same issue, what worked for me was under webform settings > Confirmation > Confirmation Type. Change the confirmation type to 'Inline (reloads the current page and replaces the webform with the confirmation message)'

This returned true for $event-&gt;getResponse()-&gt;getWebformSubmission()-&gt;isCompleted()