O'Reilly logo

PHP jQuery Cookbook by Vijay Joshi

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

Sending data to PHP

GET and POST are the two most frequently used methods for accessing pages. In the first recipe you learned to make requests using GET method.

This recipe will make use of jQuery's $.post() method to retrieve data from a PHP script. We will see a simple example where we will fill some data in a form and the data will be sent to PHP using the POST method. Sent data will be processed by PHP and then displayed in the browser.

Getting ready

Create a new directory named Recipe4 under the chapter2 directory.

How to do it...

  1. Create a file named index.html in the newly created Recipe4 directory. In this recipe, we will use the same form that we created in the second recipe (Creating query string automatically for all form elements) of this ...

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