Better form processing with fetch()

I finally put the time in and wrestled with the JavaScript fetch() API until I understood it well.

Here’s the script.

I also learned how to use the FormData constructor to easily grab all the values from an HTML form on submission. Same script. This is something I used to do with jQuery’s $( this ).serialize().

jQuery AJAX cheat sheet

I know the Fetch API is probably going to replace AJAX, and soon.

I also know that learning jQuery is less important now than it has been for a number of years.

However, jQuery Ajax commands are very useful, compact, and still necessary for many APIs. So these ready-to-use code snippets for every day can really come in handy when you just need to get some external data into your HTML quickly and easily.

The snippets cover $.get()$.post()$.load(), $.getJSON, JSON.parse() (which is pure JavaScript), and the all-purpose form tool, $.serialize(). They do not cover $.ajax(), which essentially does everything, but with more lines.