Refactored getFacetDataAjax to use smaller helper methods.