Skip to content
Advertisement

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.

Convert AJAX Jquery to Vanilla Javascript (POST) with .fetch async

I am trying to change this .ajax call from Jquery to pure Javascript. And this way I receive the JSON in my PHP: echo ‘{“enviando”:-1,”cat”:”<span class=text-primary><strong>’ . $exampleresult . ‘</strong></span>”}’; JQUERY CALL: And this is my try with Vanilla Javascript: But I get the error: SyntaxError: Unexpected end of JSON input at envSoli. And the error line: let resultado =

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.

Advertisement