何が問題なのかわからない。ユーザー名をコントローラーに送信する ajax があります。
function my_profile(username){
$.ajax({
url: "member/my_profile",
type: "get",
data: "username="+username,
success: function(){
window.location.href = 'member/my_profile';
}
});
}
そして、これは私のコントローラーです:
function my_profile(){
$username = $this->input->get('username');
$data['username'] = $username;
$this->load->view('my_profile' , $data);
}
$username を既にエコーして、ajax からアラート (msg) できることをテストしました。見つけるだけで機能します。問題は、私のビューに何も表示されないことです:
<h1>My Profile</h1>
<?php
echo $username;
?>
どうしてか分かりません。私は初期化を試みましたが$data['username'] = 'adam'
、これは機能します。