Welcome Guest, Not a member yet? Register   Sign In
http://stackoverflow.com/questions/16368728/function-called-multiple-times-in-codeigniter-controller
#1

[eluser]andrejmk[/eluser]
I have also asked this question on Stackoverflow. Here is the link to the question: http://stackoverflow.com/questions/16368...controller

Any thoughts on what might be the problem?
#2

[eluser]andrejmk[/eluser]
The title was supposed to be "Function called multiple times in Codeigniter controller", I posted the link by mistake in the title, and I can't edit it now... Smile
#3

[eluser]TheFuzzy0ne[/eluser]
Sorry, I don't understand. Is this resolved now? Your Stack Overflow post says it was due to a jQuery plugin.
#4

[eluser]andrejmk[/eluser]
It's not resolved. The page works OK when I remove the plugin. The plugin only preloads images from the "images" folder. Why would it cause the function to be called three times? I don't know if something is wrong in my .htaccess
#5

[eluser]TheFuzzy0ne[/eluser]
I have no idea, but I don't think it has anything to do with CodeIgniter.

Try installing Firebug. That will allow you to see exactly what requests are being made to the server. If it's a problem with the jQuery plugin, there's not really much we can do.
#6

[eluser]andrejmk[/eluser]
I've found what causes the error, but I don't know how to fix it Smile

If I call the page like this: /products/insert it works OK. But If I call it like this: /products/insert/ - the insert function is called three times. It's not causing me problems, because only the first time the form validation passes, but still...

If I call /products/edit/1 it always calls the function three times.

In config/routes.php I only have default route. My .htaccess is this:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|include|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
#7

[eluser]TheFuzzy0ne[/eluser]
That's strange. Try this .htaccess file instead.
Code:
RewriteEngine On

RewriteCond %{REQUEST_URI} ^/(system|application|html_store)
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
#8

[eluser]andrejmk[/eluser]
Still the same... Smile
#9

[eluser]TheFuzzy0ne[/eluser]
Have you installed Firebug yet? At the very least, that should make it clear where the requests are coming from.
#10

[eluser]andrejmk[/eluser]
Yes, I'm using Firebug, but it is not giving me any info. I asked another question on Stackoverflow: http://stackoverflow.com/questions/16484...iple-times

It loads the function three times if I have parameter in the query: categories/edit/3 or slash at the end of /categories/insert/ The suggestion from Stackoverflow was that it is due to calling three views (because of the template). I guess this has nothing to do with my configuration...




Theme © iAndrew 2016 - Forum software by © MyBB