Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djfpaagman/1bda66d4b0d450f70313 to your computer and use it in GitHub Desktop.
Save djfpaagman/1bda66d4b0d450f70313 to your computer and use it in GitHub Desktop.
Springsense Widget Setup Guide

Springsense Widget

The SpringSense widget dynamically loads SpringSense content on your page via JavaScript. It also templatable so you can customize the output to fit your own design. This manual will help you set up the widget.

Loading the SpringSense script

You can load the script by including the following code to the page;

<script src=""></script>

Setting up the template

You can customize the output of the widget by changing the template. Below you can find an example. You can insert variables using the <%= var %> syntax. Each training is rendered using this template and inserted into the container (see below). The available variables are:

  • id
  • name
  • description
  • url
  • institute_logo
<script type="text/html" id="springest_template">
  <p style="width: 400px; display: inline-block;">
    <strong><a href="<%= url %>" rel="nofollow"><%= name %></a></strong></br>
    <%= description %>
    <a href="<%= url %>" rel="nofollow"> bekijk meer</a>
  <img src="<%= institute_logo %>" style="display: inline;"><br><br>

Setting up the script

The next step is to configure the widget itself. Below you can find an example and a explanation of each setting.

$(document).ready(function() {
  var job_title = $(".job h2").text();
  var container_id = "#related-trainings";
  var callback = function(container, data) {
    $.each(data.trainings, function(_, training) {
      training.description = training.description.substr(0, 150) + "...";
      $(container).append(Springest.template("springest_template", training));
  Springest.getTrainings(job_title, container_id, callback);


Please configure the widget with your public api key, because it will be available in the source code.


Set up the domain where you want results from. The default is

var job_title

This is the job title that is sent to SpringSense to match trainings to. Use a JQuery selector to select the element and the text() method to extract the raw text.

var container_id

This is a selector in which the trainings are rendered. We advice to create a div with an unique id on the spot where you want the trainings to appear.

var callback

This piece of code converts the data it receives from Springest to actual HTML and inserts it into the page. You can leave the example, as that will suit most cases. In the example we also truncate the training description to 150 characters and add an ellipsis. You can remove this (and the parameter for getTrainings) to get our default.


The final piece is the actual call to retrieve the data and render the trainings. You should not touch this unless you're sure what you're doing.


If you need help or have any questions please contact me at or comment below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment