What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-18 10:25:06
vanilla js post form data
document.addEventListener('submit', function (event) { event.preventDefault(); fetch('https://jsonplaceholder.typicode.com/posts', { method: 'POST', body: JSON.stringify(Object.fromEntries(new FormData(event.target))), headers: { 'Content-typ... Add solution -
Other 2021-09-10 05:55:02
error handling in fetch
function CheckError(response) { if (response.status >= 200 && response.status <= 299) { return response.json(); } else { throw Error(response.statusText); } } // Now call the function inside fetch promise resolver fetch(url) ... Add solution
Best helpers
Ranking is empty