D
D
DmitryRise2017-09-20 16:14:27
Django
DmitryRise, 2017-09-20 16:14:27

How to load content on click in Django?

Greetings, there was a need to pull up articles (on the page with 10 news, in order to show 10 more news) by clicking on "More news ..."
Can you please tell me how this can be implemented within Django?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Kuzmichev, 2017-09-20
@Assargin

Of the required:

  1. View main news display page
  2. JS code that makes an ajax request to the server for the next X news
  3. View, which by ajax gives data (or ready-made html) of the next X news
  4. JS code that complements the list of news on the page with received X news

A
Alexey Ovdienko, 2017-09-20
@doubledare

Submit via pagination.
On page ajax request to get next batch of n+1 pages > read json_response from View > insert content below. If there is no further page, then do not add anything.

A
AlexandrBirukov, 2017-09-20
@AlexandrBirukov

django-el-pagination is perfect for this, but you can also get confused and do as mentioned above

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question