1
我正在製作儀表板並從SoundCloud API中提取一些信息。我對這個API相對比較陌生,並且我能夠將每個音軌的SoundCloud Widget列出。我的問題是,每次刷新時,我都會退出(我認爲)。即使用戶例如刷新頁面,會話仍然存在嗎?這是我現在所擁有的:JS:如何防止在SoundCloud API中登錄後每次刷新丟失會話
function connectToSoundCloud(){
//INTIALIZE AUTH WITH SC
SC.initialize({
client_id: sc_client_id,
redirect_uri: sc_redirect_uri
});
//INITIATE AUTH POPUP
SC.connect(function() {
SC.get('/me', function(me) {
if (me.username) {
document.getElementById('btn-disconnectFromSoundCloud').style.display="";
document.getElementById('btn-connectToSoundCloud').style.display="none";
}
$.ajax({
type: "GET",
url: "http://api.soundcloud.com/tracks.json?client_id="+sc_client_id+"",
error: function(result, status){
},
success: function(result, status){
//CODE TO DISPLAY TRACKS HERE
}
});
});
});
}
任何幫助表示讚賞。乾杯。
這樣可以保存正在發送的用戶數據,但這樣做是否也確保它們已登錄?是否仍然上傳和評論功能? – theptrk