我正在为自己的专职开发小型声音应用程序,该应用程序位于https://portfolio-st.herokuapp.com
我对歌曲请求的问题jquery函数返回状态401,但是当我直接调用rest api控制器https://portfolio-st.herokuapp.com/api/songs时,它工作正常。
AJAX呼叫:
getPlaylist : function() {
$.ajax({
type : 'GET',
url : basePath + '/songs',
dataType : 'json',
contentType : 'application/json',
success : function(songs) {
$('#radioPlaylist').empty();
for (let song of songs) {
$('#radioPlaylist').append(
'<div class="form-group">' +
'<input type="text" class="form-control songText" value="#'+ song.id + ' '+ song.title + '" disabled="disabled">' +
'</div>');
}
}
});
},
我正在为MySQL数据库使用ClearDB插件,并且MySQL Workbench桌面应用程序正在工作。
Response headers (431 B)
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Connection: keep-alive
Content-Type:application/json;charset=UTF-8
Date:at, 09 Mar 2019 16:07:20 GMT
Expires:0
Pragma:no-cache
Server:Cowboy
Strict-Transport-Security:max-age=31536000 ; includeSubDomains
Transfer-Encoding:chunked
Via :1.1 vegur
X-Content-Type-Options :nosniff
X-Frame-Options:DENY
X-Xss-Protection:1; mode=block
Request headers (409 B)
Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding :gzip, deflate, br
Accept-Language: en-GB,en;q=0.5
Connection: keep-alive
Host:portfolio-st.herokuapp.com
Referer:https://portfolio-st.herokuapp.com/
User-Agent:Mozilla/5.0 (Windows NT 10.0; …) Gecko/20100101 Firefox/65.0
X-Requested-With:XMLHttpRequest