Skip to content

Does it support append items from ajax call result? If yes how i suppose to fix the error #441

Answered by daybrush
yuhkeonggoh asked this question in Q&A
Discussion options

You must be logged in to vote

@yuhkeonggoh

You can use wait and ready and append at success timing.

ig.on("requestAppend", (e) => {
    e.wait();
    const nextGroupKey =  (e.groupKey || 0)   1;
$.ajax({
type: "GET",
url: route,
cache: false,
data: {page : nextGroupKey},
success: function (result) {
var data;
if (typeof(result) === 'string') {
data = JSON.parse(result);
} else {
data = result;
}
for (let i = 0; i < data['posts'].length;   i) {
nextItems.push(<div class="item"></div>);
}
    e.ready();
    ig.append(getItems(nextGroupKey), nextGroupKey); });
},
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yuhkeonggoh
Comment options

Answer selected by daybrush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants