Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch参数的正确设置 #2

Closed
yeongjet opened this issue Nov 28, 2016 · 0 comments
Closed

fetch参数的正确设置 #2

yeongjet opened this issue Nov 28, 2016 · 0 comments

Comments

@yeongjet
Copy link

yeongjet commented Nov 28, 2016

let data={username:"jack",password:"123}
fetch("user",{ 
    method:"POST",
    headers:{
    "Content-Type": "application/x-www-form-urlencoded",
    }, 
    body:"username="+data.username+"&password="+data.password
}).then(
    response => response.json()
).then(
    data => console.log(data)
).catch(
    e => console.error(e)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant