Ajax and the POST Method

Passing information to PHP programs using a GET is useful for most situations in which you want to send information to a server-side program and when that information will easily fit in a URL. Sometimes, however, you want to send more information than can easily be put into a URL. For those cases, it's best to use the POST method to send information to a server-side program.

The POST method is usually used in combination with an HTML form, such as the one shown in Figure 16-11.

A typical HTML form

Figure 16-11. A typical HTML form

The code for the standard HTML form shown in Figure 16-11 might look like this:

<form method = "POST" action = "http://www.somesite.com/program_name"> ...

Get The Book of JavaScript, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.