Unable to use Javascript async? | XM Community
Question

Unable to use Javascript async?

  • 20 May 2020
  • 1 reply
  • 42 views

Badge +1

I am trying to add custom javascript to a survey question. When I try to put the following code into the java script editor, I receive the warning "Invalid JavaScript! You cannot save until you fix all errors: Unexpected token function". Removing the "async" keyword allows me to successfully save the code. Why can't I use async?

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
async function hello() { return "Hello" };
hello();
});


1 reply

Userlevel 3
Badge +2

Maybe because async is not supported in IE11?

Leave a Reply