Time for the 2023 version of our favorite question - how to implement select2 with ajax data in Qualtrics!
From Qualtrics, I need to pass the study site selected on the form to my API and get back a list of study participants to put into a select so the desired participant can be selected. What is the proper way to do this?
I tried making the API call in the Survey Flow, setting an embedded data variable for the data coming back, and pointing the select2 ajax data at it but that is not working. The API is sending the data in the correct select2 format (https://select2.org/data-sources/arrays). I can see it in Postman. But nothing is showing in Qualtrics.
I also thought I could call the API from the select2 ajax URL but I don’t know the syntax for sending the Qualtrics parameters to it on the URL so bailed on that attempt and came here.
I followed this 4 year old article for the basic setup so I have the correct header css/js, question type, and question JavaScript. Qualtrics.SurveyEngine.addOnReady(function() {
jQuery("#"+this.questionId+" select").select2();
});
I feel like I’ve tried everything but the pieces aren’t coming together. I’m happy to Zoom with anyone who has done this before and document the exact steps to share with others! Thank you in advance!