I\'d like to send some data using an XMLHttpRequest in JavaScript.
Say I have the following form in HTML:
<
Here is a complete solution with application-json:
application-json
// Input values will be grabbed by ID // return stops normal action and runs login() Submit
Ensure that your Backend API can parse JSON.
For example, in Express JS:
import bodyParser from 'body-parser' app.use(bodyParser.json())