I write for the online store online assistant. There's an ordinary commet chat. The task is to make an answering machine if there are no managers in the network. Help advice. For a start, implemented a database of questions with answers.

1) Вопрос 1 1) Ответ 1 1) Вариант ответа 1 2) Вариант ответа 2 .... 2) Ответ 2 .... 2) Вопрос 2 .... 

This is how you call the operators of the cellular companies and there before connecting with the operator there are options (blanks) for ready-made solutions (For one thing, press one. To press 2, etc.)

All answer options are accompanied by actions, for example:

 1) Как добраться до нас 1) Пешком 2) На машине 

The visitor sends 1-ku to the chat and receives in response two options, sends 2 and the site is redirected to a page with directions and so on.

There was a question how to implement the client part. Download all questions / answers to the client and process on the client side, or do all requests process on the server side?

  • Depends on size and logic. I would leave it on the server. At least in the event that in the future they decide to add a mind to the answering machine, and if step-by-step navigation didn’t give anything, they would fasten, for example, search in the text of questions. - drdaeman

1 answer 1

If there are not many questions and answers, you can load them into a variable when you open the chat. If otherwise, then respectively.

  • I think they will not be much ... 100-200 lines in the database of everything. for them there is an interface in the admin ... you can add and delete. I think it’s not loading right away, but after when the assistant opens ... the site itself on the Ajax does not reboot - Yoharny Babay