About 785,000 results
Open links in new tab
  1. Using the Fetch API - Web APIs | MDN - MDN Web Docs

    Apr 28, 2025 · With the Fetch API, you make a request by calling fetch(), which is available as a global function in both window and worker contexts. You pass it a Request object or a string containing the URL to fetch, along with an optional argument to configure the request.

  2. How to Call an API in JavaScript – with Examples

    Nov 3, 2023 · To make API requests in JavaScript, you can use the fetch API, which is built into modern browsers. It is a promise-based API that makes it easy to send HTTP requests and handle responses asynchronously. Here's how to make a GET request using fetch: console.log(data); }) .catch(error => { . console.error('Error:', error); }); In the code above:

  3. 4 Ways to Make an API Call in JavaScript - GeeksforGeeks

    Aug 28, 2024 · 4 Ways to Make an API Call in JavaScript: 1. API Call in JavaScript Using XMLHttpRequest. XMLHttpRequest is an object used to make API calls in JavaScript. Before the release of ES6 which came with Fetch and libraries like Axios in 2015, it …

  4. How to call a REST web service API from JavaScript?

    Oct 6, 2021 · It simplifies the XMLHttpRequest syntax you see in many of the other examples. The API includes a lot more, but start with the fetch() method. It takes two arguments: A URL or an object representing the request. Simple GET: const response = await fetch('http://example.com/movies.json');

  5. JavaScript Fetch API - JavaScript Tutorial

    Fetch API provides a simpler and more flexible way to make HTTP requests compared to XMLHttpRequest object. Use fetch() method to make an asynchronous web request to a URL. The fetch() returns a Promise that resolves into a Response object.

  6. JavaScript Fetch API - W3Schools

    The Fetch API interface allows web browser to make HTTP requests to web servers. 😀 No need for XMLHttpRequest anymore. The numbers in the table specify the first browser versions that fully support Fetch API: The example below fetches a file and displays the content:

  7. How to Make a JavaScript API Call - Built In

    Jul 29, 2024 · In JavaScript, there are four ways to make an API call: XMLHttpRequest, fetch(), Axios and jQuery AJAX. Learn how to leverage each one to make HTTP requests and retrieve dynamic data from a server/database.

  8. How To Use an API with JavaScript (Beginner's Guide) [JavaScript API

    Aug 21, 2024 · Learn how to use an API with JavaScript! Easy & simple beginner's guide with examples. Included are free and open APIs available for testing.

  9. Fetch API - The Modern JavaScript Tutorial

    Oct 12, 2022 · Requests are split into 3 types: Request to the same origin. Request to another origin. Request from HTTPS to HTTP (from safe to unsafe protocol). Unlike the referrer option that allows to set the exact Referer value, referrerPolicy tells the browser general rules for …

  10. Request - Web APIs | MDN - MDN Web Docs

    Apr 4, 2025 · The Request interface of the Fetch API represents a resource request. You can create a new Request object using the Request() constructor, but you are more likely to encounter a Request object being returned as the result of another API operation, such as a service worker FetchEvent.request .

  11. Some results have been removed
Refresh