Skip to content

Tag: fetch-api

Get Reponse Code and JSON Response in Fetch

I have following Code to get the Response from the API. Now I want a response if the data are successfully send to the server. My first idea was to do it with the response code. If it is 200 it is successfull. The other idea is, to make it with a try catch statement. Getting the response from the

Convert CURL to javascript fetch

How can I convert the following CURL command to javascript fetch? I used the above command on my server is working. Then I throw this command to many online CURL to javascript fetch converters, and they all return only like this: The above fetch code is not working for me. and it returns Uncaught (in promise) TypeError: Failed to fetch.

How do I properly make click event on fetched “buttons”?

I fetch all users from database via this code After they fetched, I generate an element and add that element to the list. That works fine, but! I have this part of code In my logic, after elements generated, and window loaded, all items with class users__user-field must have a click event to toggle selected class. But that’s doesn’t work.

Checkboxs leading to a fetch call to produce data

As a user when I submit this form I want a fetch call for each checkbox that is checked So that I can load information from the API depending on what the selections are. Using Materialize framework and jquery or plain javascript is fine. Hard question to explain but on form submit I want to bring up information depending on