Category: PHP, api, javascript

A blog on PHP, JavaScript and more Amit Merchant · August 4, 2020 · ⋆ JavaScript So, for instance, if I want to make a GET call to this API (https://jsonplaceholder.typicode.com/posts/1), I can comfortably do it like so. Now, as you can see here, the Fetch API will call the provided endpoint and return whatever response in form of a Promise.

As you can see, the response.status states that the response is 404 and response.ok states that the request is failing.

Follow me on Twitter @amit_merchant How to check if the API call is failing using Fetch in JavaScript Creating your own custom conditional directives in Laravel Blade Things to consider before using arrow functions in JavaScript Remove event listener once it's invoked in JavaScript Freeze scroll on arrow key up or down using JavaScript
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners