jQueryを使用したZendFrameworkアプリケーション。ログインはnyroModal(http://nyromodal.nyrodev.com/のjQueryプラグイン)を介して行われます。検証など、すべてがうまく機能しますが、ユーザーがログインし、Zend_AuthがダッシュボードにリダイレクトするIDを書き込んだら。リダイレクトは、ブラウザフレームをリロードする代わりに、モーダル内で行われます。
モーダルのビュースクリプトは次のとおりです。
<?php if($this->login_success) echo $this->login_success; ?>
<div id="login_modal">
<h2>Login</h2>
<?php echo $this->form; ?>
<div class="submit" onclick="submitForm('login')">Log In</div>
</div>
これが私のsubmitForm()です:
function submitForm(thisform) {
var action = $('#' + thisform + '_form').attr('action');
var form = $('#' + thisform + '_form').serialize();
$.post(action, form, function(result) {
var response = $(result);
var html = response.filter('div:first').html();
$('#' + thisform + '_modal').html(html);
});
}
ログイン成功時のauthControllerからの応答は次のとおりです。
$url = $this->view->url(array('controller' => 'billing',
'action' => 'index'), null, null);
$this->view->login_success = '<script type="text/javascript">
window.location = "'.$url.'"
</script>';
私も使ってみました:
$this->_helper->redirector('index', 'billing');
しかし、それは常にダッシュボードをモーダルにロードしていました。上記の最初のコードブロックごとに、Loginヘッダーとフォームが表示されています。
このモーダルを閉じて、ユーザーが適切に/ billingにリダイレクトされるようにするための回答を楽しみにしています!