Conditionally show element based on external API response

I’m trying to get an alert to display or not display, depending on the output of a form submission. Here are the steps that I’d like to happen:

  1. User submits form (POST request).
  2. Form input is sent to external API (POST request) and external API response is received.
  3. Alert display conditionally, depending on the output of the API response.

I have everything working except the “conditionally” part (I can get the alert to show on a button click, and I’ve checked that the API response is as I expect in Chrome’s developer tools). I’ve been trying to get the conditional alert working with the “Show” dynamic attribute on the alert where I select the relevant part of the form’s “data” and do a string comparison on that. Is this the right way to do this, or am I supposed to do this a diffferent way?

Community Page
Last updated: