Q: Trouble storing entire string as data attribute I'm currently trying to pass data from an HTML data-attribute like so:
// From
$(".search-results").append('<div data-id=' + movie.id + ' data-title=' + movie.title + ...'

//To
$('#movie-info').append('<h5>' + ($(this).data("title")) + '</h5>');

The trouble is that only the first word in the movie string is being passed. Not quite sure why.

A: You need delimiters for the attribute, when it can contain spaces:
$(".search-results").append(
   '<div data-id="' + movie.id + '" data-title="' + movie.title + '"...'

You should also consider if it needs HTML encoding, i.e. if it could contain characters like ", <, > or &.

An easy way do avoid problems with creating HTML code is to create elements instead:
var div = $('<div>').data({ id: movie.id, title: movie.title });
$(".search-results").append(div);

The same would work when you use the value, to avoid that the title is interpreted as HTML:
var header = $('<h5>').text($(this).data("title"));
$('#movie-info').append(header);


A: The values of attributes should be enclosed in quotes.
It should look like this:
// From
$(".search-results").append('<div data-id="' + movie.id + '" data-title="' + movie.title + '"...');

//To
$('#movie-info').append('<h5>' + ($(this).data("title")) + '</h5>');

