M
M
myskypesla2016-11-08 20:05:46
JavaScript
myskypesla, 2016-11-08 20:05:46

How to get data on click through AJAX SMARTY template engine?

Using Smarty, 6 blocks will initially be loaded, with names, ages, etc.
At the bottom there is a button "Show more"
How to make it so that when you click on the button to show more, 6 more elements are loaded using AJAX?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
yanis_kondakov, 2016-11-08
@myskypesla

function getNextSixItems() {
$.ajax({
type: 'POST',
url: "/url/to/some/action/",
dataType: 'json',
success: function (data) {
here your code/ 
}
});
};

$(document).on('click', '.showMore', function (e) {
e.preventDefault();
getNextSixItems();
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question