Skip to content
Advertisement

Tag: fetch-api

My browser sends fetch data request continuously and it gives pending status after giving 200 several times in react

I’m trying post some data in mongodb database and it works perfectly until the fetch request is sending continuously even if I didn’t do anything. In the network tab, it shows 200 status firstly but then pending and gives error. The error is giving after adding the following code: The following error occurs: Note: The server side is okay and

How can data from a GET request be displayed in HTML?

When I click on my button, I expect the data from the endpoint to be returned. However, I get this error: This is my function: Answer You’re replacing the innerHTML in every iteration. Did you mean to append to it? You should also be using the properties from each element iteration. Trying to access them on response (an array) is

How to Configure Server API to Receive a Request Body Using Fetch and Express JS?

I’m trying to send a JSON file from the client to the server, but when I try to do so I get the error: “No ‘Access-Control-Allow-Origin’ header is present on the requested resource”. I also get the errors “POST http://localhost:3000/ net::ERR_FAILED” and “Uncaught (in promise) TypeError: Failed to fetch at index.js:6:1”, but I’m not sure if they’re relevant or symptomatic

javascript fetch api not working and giving error [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 11 months ago. Improve this question

promise not work as expected misunderstanding?

why the data is not logged and promise is logged in the first code? Answer This is only to demonstrate how you would get the data out of the promise (don’t do it this way): The second code is actually a shortened version of: This is the correct way of chaining Promises. As you can see, we return the Promise

Advertisement