I have this code in PHP and I cannot get item.thumb to work. Its something with quotes, I have tried everything. It stays as a string. item.id, item.title, item.description work fine.
This line is the problem:
"<img class=\"hap-selectize-thumb\" src=\" + item.thumb + \" />" +
Here is the whole:
$markup .= '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".'.$id.'").selectize({
searchField: ["title","description"],
valueField: "id",
labelField: "title",
placeholder: "'.$placeholder.'",
options: '.json_encode($data).',
render: {
option: function (item, escape) {
return "<div class=\"hap-selectize-option\">" +
"<div class=\"hap-selectize-image\">" +
"<img class=\"hap-selectize-thumb\" src=\" + item.thumb + \" />" +
"</div>" +
"<div class=\"hap-selectize-text\">" +
"<span class=\"hap-selectize-value\">" + item.id + "</span>" +
"<span class=\"hap-selectize-title\">" + escape(item.title) + "</span>" +
"<p class=\"hap-selectize-description\">" + escape(item.description) + "</p>" +
"</div>" +
"</div>";
}
},
});
});
</script>';