Answer the question
In order to leave comments, you need to log in
How to display the 1s-Bitrix component using ajax?
The "News" component is used. The page contains a list of news, when you click a button on one of the list items, you need to display the detailed page of the selected item.
Answer the question
In order to leave comments, you need to log in
There are many solutions. Alternatively, you can use colorbox or lightbox, which opens the detail page. Of course, we pass the ID of the element required to display.
The scheme is something like this:
In the news list template, remove the links and save them in some attribute, for example "data-url". links are better done without CNC, like /news/detail.php?ELEMENT_ID=99.
In js, put an event - when you click on the news, an ajax request for the desired link. put a separate site template (empty) on /news/detail.php, place a minimalistic "news in detail" component on the page.
Substitute the result of the request (html of the received news) into a hidden div on the parent page and show it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question