In the end wash, there are only three ways to pass data from a web browser to a server.
- File upload: Doesn't count in this case. Can be ignored.
- Submit a form: Pass data as form fields, process on remote site as a form. Data can be passed back to Javascript either as form fields or embedding
var statements in the new document.
- AJAX: Submit a small amount of data, wait for the server to give you a small amount of data back. Not difficult to do, but requires a slightly different way of thinking. JSON is frequently used as a standard of moving data around. There are various AJAX wrappers out there, most as easy to use as the over-advertised jQuery.
To post a form with Javascript is fairly easy. Create the form using your standard HTML markup. Use standard Javascript and DOM methods to update the form values.
Assuming only one form on your document:
document.forms[0].submit();
Edit: From the comments:
For the HTML:
<form action="#">
<div>
<input type="hidden" name="datatosendback" id="datatosendback">
</div>
</form>
For the Javascript:
document.getElementById("datatosendback").value = "OH! Mr KOTER! SEND ME!";
There are a number of other ways to access form fields and values. A google search for 'javascript modify forms` brings up pages.