I'm trying to use an AJAX query inside of a survey question to draw in a bit of content. When I test the javascript outside of LimeSurvey, it works just fine; but when I try implementing it inside of a survey question, it fires off the ".fail()" status and reports an error.
Is there a particular trick to getting AJAX queries to work in LimeSurvey?
Here's a copy of the JavaScript code we're using:
<script>
$(document).ready(function() {
var thisTitle = "swls1";
var thisSid = "54558";
var thisLang = "en";
var ajaxUrl = "
sardiprogram.com/vronline/limesurvey_ajax.php
";
$.get(ajaxUrl, { title:thisTitle, sid:thisSid, language:thisLang } )
.done(function(data) {
alert (data);
$("#put-it-here").html(data); // load form fields
})
.fail(function() { alert ('Still does not work');
});
});
</script>
This script is implemented outside of LimeSurvey and gets the results of its Ajax query here:
sardiprogram.com/vronline/kentest.php
But in this one question survey, it gets the "fail()" text alert instead of the success condition:
www.wittprojects.net/survey/index.php?r=...x/sid/638999/lang/en
Can anyone shed some light on what may cause this script to fail in a LimeSurvey context even though it works elsewhere?
Many thanks!