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.
Construct an example of key-value string of
username = anonymous and
userid = 0:
Create a callback object to handle the response and pass an array of values to success and failure as the argument.
YAHOO.util.Connect.asyncRequest to send the request to post.php, and the PHP script will return the readable output of
handleSuccess callback will print the response object's properties, including the server response data.
Note: You are viewing this example in debug mode with logging enabled. This can significantly slow performance.
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.