CodeIgniter Forums
ajax issue with Codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: ajax issue with Codeigniter (/thread-52408.html)



ajax issue with Codeigniter - El Forum - 06-09-2012

[eluser]deeptik[/eluser]
I am using ajax to display content dynamically on function call.

Issue is if a image file called in ajax content is missing.

session start storing wired/absurd values.

My problem is there will be always some image missing, so i can't correct the image issue.

How to stop the weird behaviour of session.

Please help me.


ajax issue with Codeigniter - El Forum - 06-09-2012

[eluser]InsiteFX[/eluser]
Check to see if the image exists before you try to use it.



ajax issue with Codeigniter - El Forum - 06-09-2012

[eluser]deeptik[/eluser]
since the data is in blob format ,it contain images and text,
plz help me how i can check about the image


ajax issue with Codeigniter - El Forum - 06-10-2012

[eluser]Tim Post[/eluser]
[quote author="deeptik" date="1339248428"]since the data is in blob format ,it contain images and text,
plz help me how i can check about the image[/quote]

Perhaps try posting the relevant code? It's impossible to help you without it.


ajax issue with Codeigniter - El Forum - 06-10-2012

[eluser]deeptik[/eluser]
I am using BLOB data from table to display content , which contain images url and texts,

If there is any images missing in the content or url is wrong.

Codeigniter session stores absurd value by its own.

How to solve this issue. Plese help me
Code:
function startTest($testid=0){

    $this->session->set_userdata('testid',$testid);
    $this->load->model('testpaper');
$this->session->set_userdata('qCounter',1);
$this->session->set_userdata('lasttime',time()); $data['testparam']= $this->testpaper->testDetail($testid); //get the first question also testid is test paper id

    $questionlist=$this->testpaper->questionlistByTestId($testid);

    $this->session->set_userdata('questionlist',$questionlist);

    $this->session->set_userdata('testid',$testid);

     $this->load->view('view_testheader');
        $this->load->view('view_studentexam',$data);


}
i am storing the questionlist in session

and call the below function on button click
Code:
function nextQuestion($questionId,$response,$end=0){

      $this->load->model('testpaper');

      $s=$this->session->userdata('qCounter');
        $reply[$question]=$response;          

           $res=explode(',',$response);
           foreach($res as $r){
              $permissions[$questionId][]= $r;
            }

         // time code ends


        $per = $this->session->userdata('permission');
        if(is_array($per)){
              $result= $per + $permissions;
              $this->session->set_userdata('permission',$result);

           }
           else{
              $this->session->set_userdata('permission',$permissions);
           }

          $this->session->set_userdata('qCounter',++$s);

          $this->testpaper->nextQuestion($arr[$s]);

  }
below is the model i am calling


Code:
function nextQuestion($questionId){

    $this->load->model('question');
    $question=$this->question->editQuestion($questionId);


                     echo  '<div class="questionblck">';


                           echo $question['childQuestion'][0]['name'];


                      echo '</div>

                       <div class="answerblck">
                                 &lt;textarea name="response" rows="5" cols="70"&gt;&lt;/textarea>
                        </div>';



    echo '&lt;input name="probid" id="probid" type="hidden" value="'.$question['childQuestion'][0]['id'].'"&gt;';




            echo '         </div>

               <div class="float-left gutter-right">';  

                echo    '<div class="float-left">
                             <span class="label">&nbsp;</span>
                             <button type="button" id="prevQuestion">Previous</button>
                        </div>';



ajax issue with Codeigniter - El Forum - 06-10-2012

[eluser]CroNiX[/eluser]
If you post your code using the code tags, more people would probably look at it.