2017-11-23 23 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); }); 
    } 

、エラーがある{ "_40":0、 "_ 65":0、 "_ 55":NULL、 "_ 72":ヌル}

答えて

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

関連する問題