Ajax Pagination Problem |
[eluser]stORM[/eluser]
Hi, I just have two small problems with the pagination class... Maybe I need to explain exactly how my site layout looks like to give you a better understanding hopefully you can see whats wrong... I do have a base_theme folder which is out site of the codeigniter directory. This folder contains /img /js /css as subfolders. The whole homepage is basically a so called one page layout means, if you click on a link in the navigation it does not load another page it will just scroll down to the section within the page... In my views I've created a subfolder /inc which includes header_view.php and footer_view.php The header_view.php content is just the usual header content. While the footer_view.php content loads jquery scripts... Now the funny part: When I use the pagination class everything seems to work correctly. So I assumed nothing wrong at all. So I began to use ajax instead well and the trouble begun. The problem is when I click on the pagination links the content from the database is shown correctly as assumed without the full page reload (which I need to avoid thats the reason for me using ajax because of the homepage layout) but any jquery script the site used before is not working anymore (e.g. fading links, gallery script and such.) The bad thing is there is "NO" error inside the console so I cant track it down... Even while inspecting elements I could see that all scripts are loaded! When I make a full page reload again all scripts working as expected. Any clues? Next problem (not really a problem just wanted to know if that would be possible?) The pagination links e.g. are shown in this way for my site: http://127.0.0.1/ci/home/index/5 So I wonder would it be possible to change it to look like this: http://127.0.0.1/ci/home/index/5/#blog_comment Some info about the first problem: Header_View.PHP Code: <?php echo doctype('html5') . "\n" ?> Footer_View.php Code: </div><!-- /wrapper --> Ajax.php (this one is used for the ajax pagination) Code: <?php Home_php (The Controller) Code: public function index ($offset='') Home_View.php Code: <?php $this->load->view('inc/header')?> AJAX (script which does the ajax pagination) Code: (function() { Sorry for the long post! kindest regards
[eluser]InsiteFX[/eluser]
Show your footer code with all the javascript links! It probably a javascript conflict...
[eluser]stORM[/eluser]
Ok but wouldn't I get an error inside of the console? Anyway here it is: Code: </div><!-- /wrapper -->
[eluser]InsiteFX[/eluser]
Your checking for an Ajax request the old way, this is the new CI way. Code: if ($this->input->is_ajax_request()) I would also read up on the jQuery No Conflict.
[eluser]skunkbad[/eluser]
[quote author="InsiteFX" date="1333412607"]Your checking for an Ajax request the old way, this is the new CI way. Code: if ($this->input->is_ajax_request()) I would also read up on the jQuery No Conflict. [/quote] What are your thoughts on the reliability of is_ajax_request(). I've been doing some reading, and it may not be 100% reliable. I personally set a custom post var, and switching to is_ajax_request() would be nice...
[eluser]InsiteFX[/eluser]
@skunkbad, It does the same thing that the old version did. I extend the session library and in the session update I check to see if it is an Ajax call. So far I have not had any troubles with it. This is the code in the input class: Code: // --------------------------------------------------------------------
[eluser]CroNiX[/eluser]
That method will always work if you use jQuery as jQuery explicitly sets that header for its ajax functions. I believe mootools does as well. Others might not, but I haven't run into a case yet where it didn't work. I take that back, I have run into a case where the ajax functionality was manually created and the header wasn't set.
[eluser]stORM[/eluser]
Well it could be a conflict but I dont really think it is since NoConflict is also used in other script files. Anyway I think best would be include the jquery stuff one by one stripping it down and see when it happend hopefully I'll see what went wrong then. Thank you for pointing the new way I didnt know it exists. Much to learn for me I'll just started PHP coding a week a go with CI ![]() ![]() Uhm but dont get me wrong the ajax pagination works perfectly but not the other jquery scripts which I load in the body part they dont work anymore when I use ajax pagination. best regards
[eluser]skunkbad[/eluser]
Yes, I am always using jQuery. I would be pretty lost without it. I'll give it a shot. |
Welcome Guest, Not a member yet? Register Sign In |