• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeigniter with Ben alman BBQ script gives a serious load looping problems

#1
[eluser]Jarmo77[/eluser]
Hi everyone!

I'm working on a project where i use Ben Alman's jQuery BBQ Back button script. (http://benalman.com/code/projects/jquery...-advanced/).
I've pretty much copied the script from his page and pasted it into my header.php view. I load header and footer in every view i create and between them i put the rest of the view that i wanna output.

I've ran into some problems on the way, i load a CI controller with jquery.load() and get some values from a database return the results to the controller and then to a view. All is well until the last part, loading the view with the data i got from the database.

When i load the view and pass the data to it, the view falls into a loading loop, where all my js scripts and jquery.load() loops over and over again.

Problem is that the BBQ script loads over and over which triggers jquery.load in the script which reloads the controller and rest of the chain. How do i prevent this behaviour?

// Jarmo


#2
[eluser]Aken[/eluser]
When you call the controller with jQuery.load(), does the subsequent view loading reload the entire website (inc. header and footer), or just the appropriate content view? It's possible you're loading everything again, which causes a second load, which triggers the loop.

We might not be able to help you without seeing code and/or your website. It's one of those things that could go wrong in multiple places, so it depends on how you've coded things so far.

#3
[eluser]Jarmo77[/eluser]
Thanks for the fast answer Aken.

Yes i do load header and footer again, and in header is where the script is so it gets loaded again which triggers the scripts and causes the loop?

Basically my header.php holds the doctype, scripts , css, body and content div .
My footer closes the content div, body and html.
The subsequent view has Ben Almans bbq divs thats needed for the script (and header.php/footer.php atm).

Should i i remove load header part from the view and that way prevent the loop, or should i move the script somewhere else? I mean if i wanna call a new controller from this view that also gets called by ajax and loads it view and i want to save the "state" using BBQ script, removing the script from header.php won't cause problems with the saving the "state" in the new view?

The more i think about it the more sense it makes, i should only push the database data to the subsequent view, remove loading of the header.php and footer.php and push it to the

Can't try this nor post any code until monday when i have access to the code again, but i appreciate discussing this problem theoretically Smile

#4
[eluser]Jarmo77[/eluser]
Nevermind i fixed itBig Grin


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.