G
G
gomerIT2020-12-06 04:16:49
PHP
gomerIT, 2020-12-06 04:16:49

How to change the content of only a certain block?

Hello, I am studying the MVC pattern and now when I access a certain url, I take the necessary layout file from the view folder to display the content. The site has a side menu where JS logic is executed (For example, opening blocks, highlighting the active menu item, etc.). I would like not to reload the page and change the content in a specific block. I'm thinking of using ajax requests to the server and getting ready-made layout as a result of rendering using JS. Most likely I have already answered my own question, but suddenly I think wrong. Tell.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2020-12-06
@gomerIT

I'm thinking of using ajax requests to the server and getting ready-made layout as a result of rendering using JS.

Right.
For starters it's ok.
Then you can switch to using a template engine on the client and getting not markup via Ajax, but pure data in json.
The third stage is the transition to using the js framework.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question