docs/js/demos/ajax.js
function getMarkupFromData(dataForSingleItem) {
  var name = dataForSingleItem.first_name + ' ' + dataForSingleItem.last_name;
  // https://www.paulirish.com/2009/random-hex-color-code-snippets/
  var randomColor = ('000000' + Math.random().toString(16).slice(2, 8)).slice(-6);
  return [
    '<div class="js-item col-3@xs col-3@sm person-item" data-id="' + dataForSingleItem.id + '">',
    '<div class="person-item__inner" style="background-color:#' + randomColor + '">',
    '<span>' + name + '</span>',
    '</div>',
    '</div>',
  ].join('');
}
function getMarkupFromData(dataForSingleItem) {
  var name = dataForSingleItem.first_name + ' ' + dataForSingleItem.last_name;
  // https://www.paulirish.com/2009/random-hex-color-code-snippets/
  var randomColor = ('000000' + Math.random().toString(16).slice(2, 8)).slice(-6);
  return [
    '<div class="js-item col-3@xs col-3@sm person-item" data-id="' + dataForSingleItem.id + '">',
    '<div class="person-item__inner" style="background-color:#' + randomColor + '">',
    '<span>' + name + '</span>',
    '</div>',
    '</div>',
  ].join('');
}
function getMarkupFromData ( dataForSingleItem ) { var name = dataForSingleItem . first_name + ' ' + dataForSingleItem . last_name ; // https://www.paulirish.com/2009/random-hex-color-code-snippets/ var randomColor = ( '000000' + Math . random ( ) . toString ( 16 ) . slice ( 2 , 8 ) ) . slice ( - 6 ) ; return [ '<div class="js-item col-3@xs col-3@sm person-item" data-id="' + dataForSingleItem . id + '">' , '<div class="person-item__inner" style="background-color:#' + randomColor + '">' , '<span>' + name + '</span>' , '</div>' , '</div>' , ] . join ( '' ) ; }
Convert an object to HTML markup for an item.
@param {object} dataForSingleItem Data object.
@return {string}
Convert an object to HTML markup for an item .