Webservice JSON data not showing in HTML ID's.

StefanMuschStefanMusch NetherlandsCommunity Member Qubie ✭
edited May 22 in Qualtrics API

Webservice JSON data not showing in HTML ID's.


We developed our own webservice which we query and set as embedded data in a field called sample.0. We know the call works because the embedded data fields show up when we generate test responses. This field looks like this (but repeated 50 times for 50 loop & merge tasks)

[{feature:Star Wars: Rebels,topic:movies_tv_shows,label:Movie or TV-Show},{feature:Hereditary,topic:movies_tv_shows}]

We then have this in the JS:

var task = parseInt("${lm://Field/1}");
var featuresJson = "${e://Field/sample.0}"
var features = JSON.parse(featuresJson);

/* tried jquery */

/* also tried my elementID */	
document.getElementById("feature").innerHTML = features[task-1].feature;

And this in the HTML to display the values one by one:

Do you like <span id = "feature"></span>

However, I cannot get any of the elements to show up. I also tried just showing the task we're in from this field but I can't get anything to show in the question text.



  • TJUH_KaiTJUH_Kai Philadelphia, PACommunity Member Guru ✭✭

    i will add console.log("featuresJson",featuresJson) after reading the sample.0

    var featuresJson = "${e://Field/sample.0}"

    just to make sure i can read featureJson

  • TomGTomG Raleigh, NCCommunity Member Wizard ✭✭✭✭✭

    Instead of:




Sign In to Comment