node.js - How to get the value of response returned by post request?
怪我咯
怪我咯 2017-05-19 10:48:09
0
1
1083

    getUser: function (sessionId) {
        fetch('/account_auth_admin_new_test/personal-api.accessLogin', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                sessionId: sessionId,
                enterpriseCode: "SUNEEE",
                clientIp: "127.0.0.1",
                encryptCode:"1234567899876543",
                appCode: "XIANGPU"
            })
        }).then(function(res){
            console.log(res.json())
        }).then(function(err){
            console.log('错误',err)
        })
    }

fetch module: https://github.com/github/fetch

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
大家讲道理
getUser: function (sessionId) {
    fetch('/account_auth_admin_new_test/personal-api.accessLogin', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            sessionId: sessionId,
            enterpriseCode: "SUNEEE",
            clientIp: "127.0.0.1",
            encryptCode:"1234567899876543",
            appCode: "XIANGPU"
        })
    }).then(function(res){
        return res.json()
    }).then(function(json) {
        console.log('parsed json', json)
    }).catch(function(ex) {
        console.log('parsing failed', ex)
    }).then(function(err){
        console.log('错误',err)
    })
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!