'John Smith', 'email' => 'john.smith@example.com' ); // Use CHtml ajax to send the data $result = CHtml::ajax(array( 'url' => $url, 'type' => 'POST', 'dataType' => 'json', 'data' => $data, )); // Display the result echo $result; ?>
$url, 'type' => 'GET', 'dataType' => 'json', )); // Process the data $data = json_decode($result); // Display the data foreach ($data as $item) { echo $item->name . ' - ' . $item->email . 'Both examples use the CHtml ajax library to send and receive data asynchronously. The package library used in this example is the Yii Framework.
'; } ?>