2017-07-06 48 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控制檯 - >網絡中檢查「標題」標籤。

相關問題