YUI recommends YUI3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

This documentation is no longer maintained.

YUI Library Examples: Connection Manager: Connection Manager POST Transaction

Connection Manager: Connection Manager POST Transaction

To create a POST transaction using Connection Manager, you will need to construct a data string as the POST message. The following code example provides a step-by-step approach to creating a simple POST transaction.

Click "Send a POST Request" below to try it out, then read the description below to learn how to send POST data to the server using Connection Manager.

Using Connection Manager to Post Data and Receive the Server Response via HTTP POST

Source file and dependencies

Load the Yahoo Global Object and Connection Manager source files:

Assemble the POST message

Construct an example of key-value string of username = anonymous and userid = 0:

The Callback Object

Create a callback object to handle the response and pass an array of values to success and failure as the argument.

Initiate the POST Transaction

Call YAHOO.util.Connect.asyncRequest to send the request to post.php, and the PHP script will return the readable output of $_POST via print_r(). The handleSuccess callback will print the response object's properties, including the server response data.

Copyright © 2013 Yahoo! Inc. All rights reserved.

Privacy Policy - Copyright Policy - Job Openings