Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5957617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:25:35+00:00 2026-05-22T18:25:35+00:00

I have a CI page that will load to a div in view file,

  • 0

I have a CI page that will load to a div in view file, using jQuery. Using switch(page_parameter), I control what is showing from the page.

When I call the page for 3rd time, I set a value to the class array.
But when I call the 4th time, the array become empty.

I was wondering, is it actually possible to use the class property to store value that can be used after page re-access? Or something missing in my head?
I know that using session is not a good idea, since the real array is a big chunk of serialized xml.

Here’s my code:

class MyClass extends MY_Controller
{
    public static $pitems = array();

    function Hotel(){
        parent::MY_Controller();
    }

   function new_campaign(){
        $params = $this->uri->uri_to_assoc();
        switch($params['step']){
             case '3' : self::$pitems = array("test","another"); //here the class array was set successfully
                        $this->load->view('viewer');
                        break;
             case '4' : print_r(self::$pitems); //here the array is empty
                        break;

        }
   }

In the viewer page, there’s a call to the page:

   <a href="myclass/new_campaign/step/4">Next page</a>

Same issue also with $this->
What am i missing here?
Thanks in advance~

edit:
I saw a script that has similar scenario. it successfully reused the variable set in the constructor, instead of treating it as a class variable. i’ll look thorough to confirm this, but for now, i’ll close this thread. Thanks Chris for sharing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:25:36+00:00Added an answer on May 22, 2026 at 6:25 pm

    Im not really sure what your trying to do but I have users jQuery post()/get()/ajax() many of times in CI and have had no problems. So despite not knowing or understanding what your trying to do. I thought I’d at least say I know loading data without refresh in CI through something like jQuery isn’t an issue. Example on system I built on CI had a twitter like feed of tweets where jQuery on a timer was polling for new data and coming back with it each time accordingly if something new was to be shown.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that loads with a div populated from an include file
I have a page that will basically be used to concatenate a bunch of
I have an ASP.Net page that will be hosted on a couple different servers,
I have an asp.net page that calls a dll that will start a long
I have a button on an ASP.Net page that will call Response.Redirect back to
I am loading content into a page with ajax that will have live click
in my application i have the playvideo page where video will play, below that
I have a page that has an iframe From one of the pages within
I'm building a PHP page that will load some off site content into a
I want to load picture from web server without refreshing the page. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.