Select2 Add Custom Clickable Link to results end
HTML
<link rel="stylesheet" href="http://ivaynberg.github.com/select2/select2-3.3.0/select2.css">
<link rel="stylesheet" href="http://ivaynberg.github.com/select2/bootstrap/css/bootstrap.css">
<script src="http://cdn.jsdelivr.net/select2/3.2/select2.js"></script>
<input id="productname" />
JavaScript
$("#productname").select2({
placeholder: "Type in 'Helpless'",
minimumInputLength: 2,
query: function(options){
$.ajax({
dataType: 'json',
url: "http://developer.echonest.com/api/v4/song/search?api_key=FILDTEOIK2HBORODV&format=json&artist=metallica&title=" + options.term + "&bucket=id:songmeanings&limit=true",
success: function (data, textStatus, jqXHR) {
var song = [];
var song = [{id: "1", text: data.response.songs[0].title }];
results = [{ text: "Songs", children: song},
{text: "<a href='#'>Click Here</a>" }],
options.callback({ results: results });
},
});
}
});