When I use the hard coded javascript array as input for the map markers the markers show up just fine, so I know that the code I\'m using to display the markers is good.
Remove the single-quotes, otherwise locations will be a string and not an array:
locations
var locations = '<?php echo json_encode($locations); ?>'; //--------------^--------------------------------------^