ForgeComponents
en

Components

j-FormData

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

With this component you can send data via the POST/PUT/DELETE method to the current window or another.

  • singleton

Configuration

  • method {String} a default HTTP method (default: POST)
  • target {String} a default target (default: _blank)
  • type {String} a default form type (default: application/x-www-form-urlencoded)

Methods

  • component.send(opt)
    • opt.method {String} form method, default config.method
    • opt.target {String} form target, default config.target
    • opt.type {String} form type, default config.target
    • opt.url {String} required URL address
    • opt.data {Object} required form data in the form { key1:value, key2:value }

Use it with <ui-component name="formdata">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

example.html
<ui-component name="LAZY formdata"></ui-component>
<button>Send data</button>

<script>

	$(document).on('click', 'button', function() {
		SETTER('formdata/send', { url: 'http://127.0.0.1:8000/api/', data: { name: 'Total.js Platform' }});
	});

</script>