E
E
Egor2020-12-30 10:23:17
1C-Bitrix
Egor, 2020-12-30 10:23:17

AJAX in 1C-Bitrix. How to get detailed news data?

In the news, each news has a button for detailed viewing. When you click on the button, a window opens with detailed information. What is the correct way to get detailed data using AJAX? In my understanding, I have to send a request to the detailed page when the button is clicked, get the data and substitute it in the window that opens.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Prokhorov, 2020-12-30
@Dvornik33

send a request to the detailed page when clicking on the button, get the data and substitute it in the window that opens

As an option, if the display of the detailed and in the pop-up window is the same.
Another possible option is to create a separate file (for example: /local/templates/.default/components/bitrix/news/news.detail/.default/ajax.php), pass the id to it and connect the news.detail component in the file, with the desired template and parameters, and pass your id there. Further, after receiving the ajax results, substitute them in the right place.
The second option is more flexible IMHO.
In any case, you need to proceed from the features of the problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question