$(window).on('load', function(){
$('body').on('click', 'tr', function() {
var sourceUrl = $(this).attr('src');
$("#player").attr("src", sourceUrl);
$('#player').trigger('play');
});
function show_result(data){
$("tbody > tr").remove();
$.each(data, function(i, station) {
$('tbody').append('
\
\
\
\
Favorite\
\
\
\
'+station['name']+'\
\
| \
');
});
}
function search(query){
$.ajax({
method: "POST",
url: 'https://www.radio-browser.info/webservice/json/stations/search',
data: {
name: query
},
dataType: 'json',
success: show_result
});
};
$('#radiosearch').submit(function() {
var query = $('#radioquery').val();
search(query);
});
});