How to properly implement a JSONP form post submission on a Gatsby site
问题 I've got a site, created with Gatsby. There is a form on one of the pages, and it needs to post to an endpoint that doesn't support CORS, but does support JSONP. I've written the event handler like this, using jsonp: const handleSumbit = async event => { event.preventDefault() jsonp( "https://go.pardot.com/form/id/code/", { timeout: 10000, params: { firstname: "fname", lastname: "lname", email: "an@email.com", company: "company", }, }, (err, data) => { console.log({ err }, { data }) } ) }