Skip to main content

Posts

Showing posts with the label Fetch

Fetch Quick Sheet

Fetch Quick Sheet Fetch Quick Sheet Fetch Fetch Quick Sheet Fetch fetch('/data.json') .then(response => response.json()) .then(data => { console.log(data) }) .catch(err => ...) Response fetch('/data.json') .then(res => { res.text() // response body (=> Promise) res.json() // parse via JSON (=> Promise) res.status //=> 200 res.statusText //=> 'OK' res.redirected //=> false res.ok //=> true res.url //=> 'http://site.com/data.json' res.type //=> 'basic' // ('cors' 'default' 'error' ...