Mam skrypt, który pobiera mi ostatnio odtwarzane piosenki z Last.FM. Działa po stronie PHP, ale to nie ważne.
Chodzi o JavaScript. Pobieram dane, wszystko ok. Powinno być, bo nie jest. Funkcja zwraca błąd. Odpowiedź w XHR jest pusta, status HTTP to 0.
Kod
function last_fm(element, username, image)
{
element.innerHTML =
'<img src="' + image + '" ' +
'width="20" height="20" alt="Ładowanie" ' +
'style="vertical-align: middle;" /> Pobieranie danych …';
$.ajax({
type: "GET",
url: "http://dsh.1sthoster.com/last-fm.php?username=" + escape(username),
success: function(data) {
$(element).html(data);
},
error: function() {
$(element).html("Nie mogę pobrać danych.");
}
});
}
{
element.innerHTML =
'<img src="' + image + '" ' +
'width="20" height="20" alt="Ładowanie" ' +
'style="vertical-align: middle;" /> Pobieranie danych …';
$.ajax({
type: "GET",
url: "http://dsh.1sthoster.com/last-fm.php?username=" + escape(username),
success: function(data) {
$(element).html(data);
},
error: function() {
$(element).html("Nie mogę pobrać danych.");
}
});
}
Możecie pomóc?
Przy normalnym otwarciu z przeglądarki dostaję zwykły kod HTML i wszystko jest OK. (http://dsh.1sthoster.com/last-fm.php?username=leovandamon)
Pytałem google, nic nie dało.