Thanks to Jim Bob on another post that I made I was able to figure this out. See the code below:
Code:
<script type="text/javascript">
$(document).ready(function() {
var SurveyID = getQuerystring('ID');
var SupplierName = null;
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Supplier Questionnaire", // Use Display Name of your survey list
CAMLQuery: "<Query><Where><Eq>" +
"<FieldRef Name='ID' />" +
"<Value Type='Integer'>" + SurveyID + "</Value>" +
"</Eq></Where></Query>",
completefunc: function(xData, Status) {
SupplierName = $(xData.responseXML).find("[nodeName='z:row']").attr("ows_Which_x0020_Supplier_x0020_would");
// Prepend 'ows_' to the StaticName of the Lookup column in your survey list
}
});
$('#Supplier').append('<strong>Supplier you are reviewing: ' + SupplierName + '</strong>');
});
function getQuerystring(key, default_)
{
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
</script>
<div id="Supplier"></div>