Alternatives for async or await to resolve ajax calls to Contact Directory? | XM Community
Skip to main content

Hi all,

 

I need to fire off multiple ajax calls to do contact directory searches (i.e. https://api.qualtrics.com/c79e78a949572-search-directory-contacts) , and I need all of them to be resolved before the rest of the script/survey continues.

So my understanding of this so far:

  • Async / await does not work in Qualtrics, in fact you can’t even save the JS if those are in the syntax.
  • The async = false flag in ajax calls is deprecated and will throw warnings or even break the page in modern browser.
  • There is the ajaxStop() (also deprecated) and the newer .on( "ajaxStop", handler ) event, but I can't manage to attach this to anything (or at least, it does not seem to do anything).
  • I can't ‘nest’ the ajax calls into each others .done() functions, because I don't know beforehand how many calls I need to make. (Aside from that just feeling like a bad idea overall).

I'm at the point where I feel like the only option left is to do a do-while loop, and have the .done() functions increment some kind of global counter, but that feels like a very janky solution. Does anyone know a better way of handling this. (And no, unfortunately there is no way around the multiple directory searches)

Kind regards,

Kerwin

Be the first to reply!

Leave a Reply