• Resolved insellup

    (@insellup)


    Hello!
    Help me please. Is it possible to somehow show a specific block through js before the request is sent?
    For example, there is a filter, and it shows a block with the class ‘.container’ after the AI provides the answer.
    MwaiAPI.addFilter(‘ai.reply’, function (reply) {
    jQuery(‘.container’).show();
    return reply;
    });
    However, I really need to show the block with the ‘.container’ class before the request is executed. That is, show it immediately before executing the request. Is it possible to implement this somehow? Thank you in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Val Meow

    (@valwa)

    Hey @insellup! ??

    Instead of using the MwaiAPI, you can listen for the submit button click and execute a script at that time. This will happen before the query is sent. ??

    Thread Starter insellup

    (@insellup)

    Hey, @valwa!

    I’ve already tried this. I have already tried everything to implement this ?? .
    Below is a script that tracks clicks on the chat button. The event only works correctly if the chat is empty. However, if you write text in the chat, then clicking on the button no longer works. Can you tell me what the problem might be?

    jQuery(document).ready(function () {

    jQuery(‘.mwai-chatbot-container’).on(‘click’, ‘button’, function (e) {
    jQuery(‘body’).hide(); // Works if the chat is empty. If you enter text into the chat, it no longer works

    });

    });

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show block before sending request: Implementation using MwaiAPI’ is closed to new replies.