2017-11-23 8 views
1

api를 통해 서버로 데이터를 보내고 있습니다. 하지만 응답 시간에 오류가 나타납니다. 다음은 보내기 서버로 데이터를 전송하는 중 오류가 발생했습니다.

내 코드

fetch('http://35.196.195.208/SaveRecommendAppDetails', { 
     method: 'POST', 
     headers: {    
       'Content-Type': 'application/json' 
       }, 
     body: JSON.stringify({ 
        UserId:"23", 
        ClientId:"2", 
        Name: "Paras", 
        Email: "[email protected]", 
        Phone: "", 
        CreatedUserId:"23" , 
        Company: "Brill Infosystem"}) 
     }) 
     .then((response) =>JSON.stringify(response.json())) 
     .then((responseJson) =>{console.log("==========response=========" + responseJson) })  
     .catch((err) => { console.log("==========error=========" + err); }); 
    } 

되고 오류는 다음과 같습니다 {널 (null) : "_ 72", 널 (null) : "_40": 0, "_ 65": 0, "_ 55"}

답변

3

{ "_40":0,"_65":0,"_55":null,"_72":null } console.logPromise 개체를 얻을 때 얻을 수있는 것입니다. response.json()Promise을 반환하므로 JSON.stringify() 일 수는 없습니다. JSON.stringify()로 전화를 제거하십시오.

+0

네, 그렇습니다. 문자열 형식의 숫자를 전달할 때 db/server의 필드가 문자열인지 확인합니다. – Deee

+0

고마워요. –

+0

답변을 수락 해 주셔서 감사합니다;) – kytwb