MDL-41289 AJAX: Add endpoint and JS function to retrieve user preferences

Thanks to Vignesh <me@vignesh.info> for his initial work on this issue.