本文整理汇总了PHP中AF::isAjaxRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP AF::isAjaxRequest方法的具体用法?PHP AF::isAjaxRequest怎么用?PHP AF::isAjaxRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AF
的用法示例。
在下文中一共展示了AF::isAjaxRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateAction
function updateAction()
{
$model = new Domain();
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
if (AF::isAjaxRequest() && isset($_POST['model']) && $_POST['model'] == 'Domain') {
$model->fillFromArray($_POST, false);
if ($model->save()) {
Message::echoJsonSuccess(__('domain_updated'));
} else {
Message::echoJsonError(__('domain_not_updated'));
}
die;
}
$id = AF::get($this->params, 'id', FALSE);
if (!$id) {
throw new AFHttpException(0, 'no_id');
}
if (!$model->cache()->findByPk($id)) {
throw new AFHttpException(0, 'incorrect_id');
}
Assets::js('jquery.form');
$this->addToPageTitle(__('update_domain'));
$this->render('update', array('model' => $model));
}
示例2: json_encode
?>
</td>
<td><?php
echo $v;
?>
</td>
</tr>
<?}?>
</tbody>
</table>
</div>
<?}?>
</div>
<?if(AF::isAjaxRequest()){?>
<script>
var report = eval('<?php
echo json_encode($dataProvider['chart']);
?>
');
var data = google.visualization.arrayToDataTable(report);
var options = {
title: "Chart",
width: 600,
height: 500,
bar: {groupWidth: '50%'},
legend: { position: 'none' }
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
示例3: redirect
public function redirect($path = NULL)
{
$redirectUrl = substr($_SERVER['SCRIPT_NAME'], 0, strlen($_SERVER['SCRIPT_NAME']) - 9);
// force SSL if not present
if ($_SERVER["HTTP_HOST"] == "pinnaclecrm.com" && $_SERVER["SERVER_PORT"] != "443") {
$redirectUrl = "https://pinnaclecrm.com" . $redirectUrl;
}
if (is_array($path)) {
$redirectUrl .= implode(DIRECTORY_SEPARATOR, $path);
} elseif (is_string($path) && $path !== NULL) {
$redirectUrl .= $this->controller . DIRECTORY_SEPARATOR . $path;
} else {
$redirectUrl = $_SERVER['HTTP_REFERER'];
}
if (AF::isAjaxRequest()) {
echo '<script>window.location.replace("' . $redirectUrl . '")</script>';
die;
}
header('Location: ' . $redirectUrl);
exit;
}