I
I
Ivan Fotiev2015-10-06 16:17:17
PHP
Ivan Fotiev, 2015-10-06 16:17:17

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

2 answer(s)
A
Alexander Sorokin, 2015-10-06
@belobokin

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.

D
Dmitry Novikov, 2015-10-06
@dmitriy_novikov

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 question

Ask a Question

731 491 924 answers to any question