나는 오브젝트가 있는데 그것을 아약스 요청으로 전달해야 한다.
advanceSearch(e, field) {
this.searchString.push({
[field] : e
});
let q = new URLSearchParams(this.searchString).toString();
// this.searchTerm = e;
http.get('projects/search/'+q)
.then( ( response ) => {
console.log( response )
})
.catch( ( error ) => {
}); },
여기서thissearchString
는 객체의 배열입니다.이 오브젝트의 배열을 URL로 전달해야 합니다.그래서 저는 이 오브젝트를URLSearchParams
에러 메세지가 표시됩니다.
TypeError: Failed to construct 'URLSearchParams': The object must have a callable @@iterator property