npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

submit-form-element

1.0.2

@dominictarr

npmHomeRepoSnykSocket
Downloads:7
$ npm install submit-form-element
DailyWeeklyMonthlyYearly

submit-form-element

given a form html element, submit it with an XHR as if you had clicked submit, but without navigating the page.

sets all the necessary headers etc so that it looks like a regular form submit.

example

var submit = require('submit-form-element').submit

submit($('form'), $('button'), function (err, response) {
  //calls back error, or xhr response
})

api

getData (form, button) => {}

return a js object representing the data that would be submitted if you were to click this button.

submit (form, button, cb)

submit the given form by clicking a particular button, and callback the response

License

MIT