fetch('urlToPost', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({ key: 'value' }),
      })
      .then(response => response.json())
      .then(data => {
        console.log('Success:', data);
      })
      .catch((error) => {
        console.error('Error:', error);
      });
      Javascript language logo

      Fetch POST

      My JavaScript recipes

      Initiate a fetch call with POST method

      Shortcut: request.post

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.