I am trying to run code similar to the following:
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
jQuery.getJSON([[url]], function(data) {
variable = 1
});
// other_variable = 10
Qualtrics.SurveyEngine.setEmbeddedData('variable', variable)
});
However, nothing gets saved into the embedded data. If I put
setEmbeddedData()inside the
getJSON()function, it still does not work. The only way I can embed data is by making a variable similar to
other_variablewhich is not inside
getJSON().
I have tried to use the
varkeyword and placing the
getJSON()function in global scope. Please help me fix this. Thanks!