Welcome Guest, Not a member yet? Register   Sign In
do ajax calls instantiate the controller and/or model ??
#1

[eluser]Unknown[/eluser]
Hi
I am using ajax (xmlhttprequest object) on a view to 'GET' from a controller

Model: News_model
View: news_view
Controller: News


the constructor of the controller loads the model.

and the constructor of the model parses a xml file and puts the results in a db table.

the problem is that with every ajax call, the db table is getting filled with the parsed data again..
in other words: it seems like every ajax call is instantiating the controller and/or the model

is my question clear enough, or should I post some code?

P.S: I don't want to use an ajax framework for CI, I have to use the xmlhttprequest


#2

[eluser]CroNiX[/eluser]
Any request to the server that gets processed with CI will
-load anything that is autoloaded
-load anything that that particular controller loads
-execute anything in that controllers constructor (including any base controllers doing things)
-execute anything in that controllers method that was called

The problem is either with how you are sending the data (request) to the server or the logic in the controller not checking things properly and doing it (storing your data) again.

Beyond that - it's all guesses with no code to see.




Theme © iAndrew 2016 - Forum software by © MyBB