class recommend { constructor() { this.getRecommendFeeds(); } getRecommendFeeds() { this.Http("/RecommendFeeds", { photoId: location.search.split("=")[1] }, res => { let { list } = res; console.log(list); }) } Http(URL, params, callback) { $.ajax({ url: `http://127.0.0.1:8090/api${URL}`, type: 'GET', data: params, success: (res) => { callback(res) } }) } } new recommend();