Passing in javascript function in index.html to generate timeline variables #2941
Unanswered
synapticlee
asked this question in
Q&A
Replies: 1 comment
-
I think the way that you've described it seems perfectly reasonable. Just to recap for the sake of this thread: You can have a file like function createTimelineVariables(){
// do stuff here...
return timeline_variable_array;
} In <script src="generate_timeline.js"></script> And also call the function: <script>
var timeline_variables = createTimelineVariables();
</script> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I defined a javascript [function/script] to define an object for timeline_variables with [stimulus: blah.png, {data: {correct_response: blah}}, etc etc]. However I'm having trouble understanding how I can call this function within index.html. I have loaded the script in the html at the top with <script ..></script> but when I try to call the function e.g. foo = my_function(), it doesn't work, nor is just calling my_script() directly. How do I pass the output of this function to index.html so that I can use it in timeline_variables: [output]?
EDIT: never mind, the bug was due to a different error. for now I'm doing
var output = my_function() and timeline_variables = output, and it seems to work. Would still like to know what is the best practice/syntax for this type of operation.
Beta Was this translation helpful? Give feedback.
All reactions