According to this answer my function call should be working but it isnt: Calling a javascript function in another js file
My code (simplified):
file1.js:
$(document).ready(function(){
function loadFYfResults(sizes){
alert('hello');
}
});
file2.js
$(document).ready(function(){
$('.size-button').click(loadFYfResults(sizes));
});
theme.liquid
in the head:
{{ 'file1.js' | asset_url | script_tag }}
{{ 'file2.js' | asset_url | script_tag }}
When the function is called, the console throws this error:
"Uncaught ReferenceError: loadFyfResults is not defined"
My site is built using Shopify's liquid theme platform but I'm not sure if that has anything to do with it. Can anyone spot what I am doing wrong?