現在、ユーザーが正常に完了した後、別のHTMLファイル(つまり、dashboard.html)にリダイレクトしたいと考えています。私はこれを解決するためにヘッダーを使用することができます知っているが、私は私のコードにどこに追加する必要がありますか分からない。PHPを使用して別のhtmlファイルにリダイレクト
if (mysqli_query($Link, $Query)) {
$lastID = mysqli_insert_id($Link);
$Query2 = "INSERT INTO $table_2 VALUES (NULL,
'".$lastID."')";
if (mysqli_query($Link, $Query2)) {
$message = "You've sucessfully created the account!";
echo json_encode(array('success'=>'true', 'action'=>'login','html'=>$message, 'console.log'=>$Query));
}
else {
$message = "Error occur in query2";
echo json_encode(array('action'=>'error','html'=>$message, 'console.log'=>$Query));
}
}
else {
$message = "Error in query1";
echo json_encode(array('action'=>'error','html'=>$message, 'console.log'=>$Query));
}
お元気にお手伝いします。
あなたがPHPで構築されたコードに<a>
タグを追加することができますいずれか
Yup私はAjaxを使用しています –
@JasonLauあなたはそのサンプルを投稿できますか?その後、ajaxで成功した後にリダイレクトを行う必要があります。 – Chay22
$アヤックス({ \t \t \t \tタイプ: 'POST'、 \t \t \t \tデータ型: "JSON"、 \t \t \t \tデータ:POSTDATA、\t \t \t \t \t \t URL:「httpsを:/ /n3228691.scm.tees.ac.uk/Yii/MACC/models/class.model.registerUser.php?action=register '、 \t \t \t \t \t \t \t \t成功:関数(データ){ \t \t \t \t \tコンソール。ログ(データ); \t \t \t \t \t $( '
').html(data.html).appendTo( '。msg'); \t \t \t \t \t //$.mobile.loading('hide '); \t \t \t \t \t window.location = "https://n3228691.scm.tees.ac.uk/Yii/MACC/gallery1.html"; \t \t \t \t}、 \t \t \t \t \t \t \t \tエラー:機能(データ){ \t \t \t \t \tアラートが( 'あなたの登録を処理中にエラーが発生しました!'); \t \t \t } \t \t \t}); –