Am I misunderstanding the way the autoload function works?
Well... yes.
Autoloading means the object is loaded (instantiated) automatically when the application starts. So we won't need to load them couple of times if needed.
Note: Only necessary/essential models should be loaded automatically.
Or does it have something to do with me using Ajax
In this case, a XHR request acts as a normal HTTP request. When you send a request to a Controller/method
the whole application runs and stops after serving the result.
So the model would lost all values stored in its properties.
Looking for a solution?
I'm not sure about this, but you could store the variables in Session (by using $this->session->set_userdata()
in CI) and retrieve the stored values later.