function ResponseOnline($qid,$response)
ajax jQueryを介して値を渡すときに、新しいセッション値と古いセッション値を同時に保存することはできません。
これが私の問題です
1。ログイン後、セッションで値ストアを保存します
2。次に、ajax jqueryを介して関数に値を渡し、それを配列に格納してからセッションに格納します。
3。ajax jqueryを介してセッション値を取得すると、正しく処理されます。
4。しかし、2番目の値を渡すと、前のパスで保存したセッション値が失われます。
これが私の関数呼び出しです:
public function ResponseOnline($qid,$response)
{
$d=$qid;
$s=$response;
if($this->session->userdata('countnew')==0) // algo for this function i check the
//countnew session varaible if 0 do this
{
$sc=$this->session->userdata('countnew'); // store the countnew variable
echo $sc=$sc+1; // increment the counter variable
$this->session->set_userdata('countnew',$sc); // store it in session
echo $this->session->userdata('countnew');
$r2[$d]=$s; // store array value $r2 with key $d and
$this->session->set_userdata('res',$r2); //set this array value in session
}
else{ // if session countnew!=0 then do this
$r2=$this->session->userdata('res'); // first store $r2 as array return from session
$r2[$d]=$s; //then add value to this array
$this->session->set_userdata('res',$r2); // storing this array to session
}
echo '<pre>';
print_r($r2); // printing the array
}