The javascript to populate the portlet. JQuery is available as 'Q' and console.log() is ensured to work even in IE. The js is called in a function context with variables defined:


Examples
// Google Search Form
var googleUrl = 'http://www.google.com';
Q('#'+divId).html('Loading google home page result...');
ajaxViaJenkins(googleUrl, function(resp) {
   Q('#'+divId).html('Processing response (link rewriting, replacing this content)...');
   var responseText = resp.responseText.replace(/(\/search)/g, googleUrl + '$1');
   var responseDom = Q("<div>").append(responseText);
   Q('#'+divId).html( responseDom.find("form").first());
});

// Load JSON from API with authentication
var url = 'http://myservice.intranet/api/rest';
Q('#'+divId).html('Loading portlet...');
ajaxViaJenkins(url, "myuser", "password", function(resp) {
   var jsonObject = resp.responseObject();
   ...
});