0
我需要通過從數據庫中提取來在我的頁面上顯示評論。從服務器獲取數據並顯示
我能夠從.json文件中獲得虛擬測試數據,但是當我嘗試將它與數據庫url進行連接時,它並未獲取數據。
我使用js handlebar模板來循環html頁面中的數據。
這裏是我的js來fecth數據
var getData = function() {
console.group("getData()", "Fetching data from server at", R.settings.endPoints.incoming.getData);
var promise = $.ajax({
url: R.settings.endPoints.incoming.getData
});
console.log("getData()", "Returing the promise", { promise: promise });
console.groupEnd();
return promise;
};
DB URL設置與.getdata像下面
endPoints: {
incoming: {
getData: "http://localhost:8080/rest/review/getReview"
},
outgoing: {
sendData: "http://localhost:8080/rest/review/createReview"
}
}