Please try this fix first: The gallery only shows when I reload the page
So, if you've done all that and it doesn't work, it all comes down to a more advanced problem, coming from the theme.
Check your theme, do a mass search in the JS files for parseHTML( (yes, including the open parenthesis). It'll confirm the conjecture that your theme strips the scripts from content loaded via AJAX. Even if the request's return content has the script tags, jQuery will remove these, according to jQuery.parseHTML() | jQuery API Documentation.
What you could do, it to find and replace the occurrence of this in your theme.
$.parseHTML(data, document, true);
Adding the document and the true arguments will make it keep the scripts and your galleries will work.