2017-07-06 49 views
0

我试图发送参数使用张贴请求,但参数未达到提供所需的结果,并在控制台中打印为空。这里是我的代码请求的参数不通过API发送离子2

var headers = new Headers(); 
 
    headers.append('Content-Type', 'application/x-www-form-urlencoded'); 
 
    let options = new RequestOptions({ headers: headers }); 
 
    
 
    let postParams = { 
 
     acesscode: 'XXXXXXXXXXX', 
 
     productCode:'XXXXXXXXXX' 
 
    }; 
 
    
 
    this.http.post("http://www.ebiebook.com/drmapi/v1/details", JSON.stringify(postParams), options) 
 
     .subscribe(data => { 
 
     console.log(data['_body']); 
 
     }, error => { 
 
     console.log(error);// Error getting the data 
 
     }); 
 
    
 
}

和输出画面连接,它显示API是打很好,但参数数据无法到达提供相应的结果。请建议。 enter image description here

回答

0

您附加的此打印不显示请求发送的内容,而是仅显示浏览器从服务器收到的响应。

你最好看看这个线程在这里看到this thread更多关于。您必须从Chrome控制台 - >网络中检查“标题”标签。

相关问题