Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Suggestion to improve `load-more button` for TDunham02
// Relace the jQuery AJAX snippet by this:
$.ajax({
type: 'GET',
url: 'ajax.php',
data: {
tag: tag,
max_id: maxid
},
dataType: 'json',
cache: false,
success: function(data) {
// Output data
$.each(data.images, function(i, img) {
$('ul#photos').append('<li><a href="/media.php?id=' + img.id + '&user=' + img.user + '"<img src="' + img.url + '"></a></li>');
});
// Store new maxid
$('#more').data('maxid', data.next_id);
}
});
<?php
// Replace the data compilation and output (ajax.php file) by this:
$images = array();
foreach ($media->data as $data) {
$images[] = array(
'id' => $data->id,
'url' => $data->images->thumbnail->url,
'user' => $data->user->username
);
}
echo json_encode(array(
'next_id' => $media->pagination->next_max_id,
'images' => $images
));
@jackkkdanielsss

This comment has been minimized.

Copy link

commented Jan 2, 2014

It's not working can you fix please?

@shatmanov

This comment has been minimized.

Copy link

commented Feb 2, 2016

load-more button don't work, please fix it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.