Relative Content

Tag Archive for javascriptnode.jsfetch-api

(Uncaught promise) Failed to fetch while POST’ing different json content

I am trying to GET user listings from a node.js server with the fetch API, by POST’ing the json {pageNumber,UsersPerPage}. For that I have two buttons, that each POST their own text contents as pageNumbers to the server, when clicked. However, after iterating the two buttons 6 times the fetch API somehow fails. It does not fail if I click one button for consecutive times, but exactly when I switch between those two fetch POST requests exactly 6 times and the error message “Uncaught (in promise) TypeError: Failed to fetch at HTMLDivElement.” gets returned.