As you've already discovered, there are exactly two ways to transmit data over the http protocol: GET
or POST
. There is also a third type of HTTP message called HEAD
, but that's really only used to get the meta data around a resource without downloading it and isn't widely implemented.
Obviously both GET
and POST
are easily accessible through the use of a <form>
tag. The GET
is also easily accessible by manually adding query parameters to the URL in the form of name-value pairs (foo.html?a=1&b=2
).
The beauty and complexity of the POST
, however, is that the name-value pairs are communicated from the browser to the web server enclosed within the HTTP request header which is not as easily accessible. The only way to accomplish the POST
without using a <form>
tag is to manually alter the HTTP request header and add the name-value pairs in yourself.
Also keep in mind that an HTTP server doesn't intrinsically know whether a request (GET
or POST
) came from a main browser window or an AJAX call. Regardless, the web server will read the request, will decipher if it's a GET
or POST
request, look for name-value pairs as appropriate, and generate a response.
If you'd like additional detail on how to properly format a POST
request you can go to jmarshall.com/easy/http/ or perhaps tcpipguide.com/free/t_HTTPRequestMessageFormat.htm. The definitive resource is always the W3C, but sometimes the RFCs can be terribly confusing for us mere mortals to read.