Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Promise.all([
- fetch("http://127.0.0.1:8000/api/customers/"),
- fetch("http://127.0.0.1:8000/api/profiles/"),
- ]).then(allResponses => {
- const response1 = allResponses[0].json()
- const response2 = allResponses[1].json()
- // var test == to the Json returned in response 2
- test = {
- "count": 1,
- "next": null,
- "previous": null,
- "results": [
- {
- "city": "London, England, UK",
- "pk": 1,
- "longitude": 51.5074,
- "latitude": 0.1278
- }
- ]
- }
- console.log(test.results[0].pk) //This results in => 1
- console.log(response2.results[0].pk) //This results in undefined.
- //Uncaught (in promise) TypeError: Cannot read property '0' of undefined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement