Angular 8과 HttpClientJsonpModule을 사용하고 있습니다. 내 사용자 지정 가져 오기 기능은 다음과 같습니다.
public fetch(): Observable<any> {
// This url has been obfuscated but you get the gist. This is the expected format so I can't alter the string
const url = 'http://exampleurl:6000/GetSomeData(inputParams=@test1)?@test1={hasData=true}';
return this.http.jsonp(url, 'callback')
.pipe(
map(response => {
// always returns null
console.log(response);
})
);
}
내가 호출 할 때 this.fetch()
다음과 같은 오류를 항상 반환합니다 :
JSONP 삽입 스크립트가 콜백을 호출하지 않았습니다.
그리고 response
항상 null입니다. 어딘가에서 한 걸음 빠졌나요?
요청에 콜백을 제공하지 않았습니다. 다음 샘플에서 콜백을 제공하는 쿼리 매개 변수는 c입니다 (실제로 서비스에 따라 다름). 이러한 매개 변수에 항상 JSONP_CALLBACK 값을 제공해야합니다.
const url = ' http : // exampleurl : 6000 / GetSomeData (inputParams = @ test1)? callback = JSONP_CALLBACK & @ test1 = {hasData = true}';
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다