Skip to content
  1. Extras
  2. FetchIt
  3. Modals
  4. tingle.js

tingle.js

In this section, let's see an example of working with modal windows tingle.js.

Opening a modal

If you have the task of opening a modal window after a successful form submission, it can be solved in two ways:

  1. Using the fetchit:success event.

    js
    const successModal = new tingle.modal();
    
    document.addEventListener('fetchit:success', ({ detail: { response: { message } } }) => {
      successModal.setContent(message);
      successModal.open();
    });
  2. With FetchIt.Message.

    js
    const successModal = new tingle.modal();
    
    FetchIt.Message = {
      // ...
      success (message) {
        successModal.setContent(message);
        successModal.open();
      },
    }