Select2 AJAX Debugging | XM Community
Skip to main content

I am trying to retrieve a list of items from an API. Here is the code:
Qualtrics.SurveyEngine.addOnReady(function()
{
debugger;
console.log("Got here");

jQuery("#"+this.questionId+" select").select2({
debug: true,
placeholder: 'Select a program',
closeOnSelect: false,
width: '100%',
dataType: 'json',
     type: 'POST',
ajax: {
   url: 'https://apim-ats-all.azure-api.net/odata-api-itssmaster/odata/Training',
   params: { headers: { "Ocp-Apim-Subscription-Key": "-DELETED FOR OBVIOUS REASONS]" } }
   },
processResults: function (data) {
var testing = data;
console.log("Got here2");
console.log(data);
    return {
     results: data.items
    };
   },
id: function(connection){
     console.log(connection);
   }
});
});

The second console log command ( console.log("Got here2"); ) is never reached. The API is not receiving any calls, and I am not seeing any error messages using the. Chrome dev tools - no error messages, or any messages other than "Got here" from the first console log command ( console.log("Got here"); ) .
Is there another way to troubleshoot this that I am missing?

Be the first to reply!

Leave a Reply