Yes you need to use Ajax. Here's how I did it using JQuery and Masonry on Wordpress, it should be pretty similar on any other site though. I'm using the Masonry function Append to add the new pictures. You can see it in action in the gallery on jorarts.org
jQuery.ajax({
type:"POST",
url: "/wp-admin/admin-ajax.php",
data: myData,
success:function(response){
jQuery("#LoadingImage").hide();
if(response){
var $newPics=jQuery(response).css({ opacity: 0 });;
$newPics.imagesLoaded(function(){
jQuery("#galleryPlaceholder").append($newPics).masonry( 'appended', $newPics, true );
$newPics.animate({ opacity: 1 });
jQuery("#galleryPlaceholder a").colorbox({rel:currCat,
scalePhotos:true,
maxWidth:"90%",
maxHeight:"90%"});
});
}
}
});
Here is the JQuery Ajax documentation https://api.jquery.com/jQuery.ajax/