Answer the question
In order to leave comments, you need to log in
How to get last element via getJSON?
Good afternoon.
In general, I decided to make AJAX loading of news. Implemented everything that I wanted in principle, i.e. for example, when adding news, it immediately appears in the block. But the problem is that this reloads the entire container.
Code example:
<div class="newsContainer--list">
<div class="newsContainer--element">Сама новость</div>
</div>
$.getJSON('/?module=news&media=ajax&action=json_load_news', function(data){
$('.newsContainer--list').replaceWith($('.newsContainer--list').html(data));
});
Answer the question
In order to leave comments, you need to log in
$('.newsContainer--list').replaceWith($('.newsContainer--list').html(data));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question