Import JS from another site at specific question | XM Community
Question

Import JS from another site at specific question

  • 17 July 2019
  • 4 replies
  • 22 views

I'm trying to add some JS at a specific question from an external site. I'm doing this in the Question JS under the addOnReady event using the below:
jQuery.getScript("https://xxxxxxxx.yyyyyyyyy.net/scripted.php?p=MFVi8x5NKt39BqEw&r=${e://Field/ResponseID}&f=${q://QID4/SelectedChoicesRecode}&fl=${q://QID10/SelectedChoicesRecode}&d=&c=&v1=&v2=&v3=&t=");

The url is a PHP page with piped parameters which (I know) returns valid JS.

The issue is that this results in a Cross-Origin Read Blocking (CORB) response and is blocked. Is there another way I can add this script to my page?

Thanks!

4 replies

Userlevel 7
Badge +27
Does your php script send an appropriate CORS header to allow access?
Thanks Tom for the quick response. Yes, it does (see below) hence my thinking it's being blocked at the Qualtrics end?
!

P.S. Apologies for these newbie questions - I'm evaluating some advanced functionality to assess migration from Confirmit despite VERY limited Qualtrics experience. Your help is much appreciated!
Userlevel 7
Badge +27
getScript is essentially an ajax call. It isn't block by Qualtrics. However, I've run into situations where ajax calls get blocked at the firewall on certain networks. Therefore, it is best to avoid them if possible.

There are probably other, more straight forward ways to achieve what you are trying to do. Maybe a web service call from the survey flow?
Thanks for this explanation. I've tried adding as a simple script tag in the question HTML and get the same response so doesn't seem to be the issue.
I'll investigate adding a Web Service to the flow. It just seems that's a very complex solution to a "simple?" need.

Leave a Reply