Is it possible to get all values from a <form>
and parse it to mootools/json, so that I can use it in an XHR-request like:
var req = new Request.HTML({
method: 'post',
url: 'xhr_request.php',
data: {
formdata: $('inputform').getdata(),
someotherdata: 'hello world'
}
}).send();
At the moment I have only text-input fields. In the json I like to have the input-name or ID as the key for the value. e.g.:
<form id="inputform">
<input type="text" id="name" name="name"/>
<input type="text" id="company" name="company"/>
</form>
//mootools script parsing above to this:
data: {
'name' : 'John Doe',
'company': 'Joeys LTD'
},