Created
August 6, 2019 05:27
-
-
Save ayushgupta11/344b0d9d1a6ad613094b785a9d56a5ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let requestData = { | |
data:{ | |
"name": "name", | |
"email": "email", | |
"contact": "contact", | |
"college": "college", | |
"profession": "profession", | |
"city": "city", | |
"question1": "answer", | |
"question2": "answer", | |
"question3": "answer", | |
"question4": "answer", | |
"question5": "answer" | |
} | |
} | |
Axios( | |
{ | |
method: 'post', | |
url: 'https://tedx-server.herokuapp.com/api/register', | |
data: JSON.stringify(requestData), | |
headers: { | |
'content-type': 'application/json', | |
} | |
} | |
).then((response) => { | |
console.log(response) | |
}).catch((error) => { | |
console.log(error) | |
}) | |
/* | |
Note: All the fields mentioned in request data are necessary | |
Send all the fields when requesting service. | |
Above is an axios request that you'll use for service call. | |
I've used axios. | |
Here's the link to know how to use it: https://www.npmjs.com/package/axios | |
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |
Include this script tag in your index.html for axios. | |
That's all. | |
Handle the response as per yourself. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment