O'Reilly logo

The Book of JavaScript, 2nd Edition by thau!

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required