Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A different approach for making CodeIgniter websites/web applications AJAX enabled while keeping your URLs search engine friendly, with the power of progressive enhancement.
PHP
branch: master

README

**************************
* AJAXer for CodeIgniter *
**************************

||| Attention: This project is still in development. Please expect bugs. |||

This project uses progressive enhancement techniques to serve a CodeIgniter website via AJAX for browsers (user-agents) that support AJAX.

It was originally developed for the website of CodeBinders Web Development Services LLP (http://www.codebinders.com). This code was abstracted from that website.

Firstly, controllers in CodeIgniter should be written to serve full HTML for normal requests and serve only the page title and page-specific content for AJAX requests encodedas JSON. We use CodeIgniter's $this->input->is_ajax_request() to do this check.

Next, we use Javascript to check if browser has support for AJAX. If yes, we  modify all internal links to add a hash to their URLs and use jQuery's $.getJSON() to fetch JSON-encoded content from our controllers using the hash fragment.

-----------
- File(s) -
-----------
ajaxer-for-codeigniter-x.x.js (where x.x is major-version.minor-version. So for 0.1, the file name will be ajaxer-for-codeigniter-0.1.js).

----------------
- Requirements -
----------------

1. jQuery (>= 1.7.1) (Tested against 1.7.1. Not tested on earlier versions, but they might work, I'm not sure though.)
2. CodeIgniter (2.1.0) (Tested on 2.1.0)
3. URL rewrite for CodeIgniter enabled.
4. $config['base_url'] set to full URL of the CodeIgniter root. e.g. http://example.com/
5. Set "var baseUrl" in ajaxer-for-codeigniter-x.x.js to the value of $config['base_url'] that you have set in CodeIgniter. In the normal, unminified version, this can be found at line 8. For the minified version, it can be found at the beginning of the file.
6. Passing familiarity with CodeIgniter, PHP, jQuery, Javascript to understand what's going on :)
7. See the demo to know how you should design your controllers and views.

--------
- Demo -
--------

The "demo" folder contains a fully functional CodeIgniter 2.1.0 demo with AJAXer for CodeIgniter added.

-----------
- License -
-----------
AJAXer for CodeIgniter which includes the "ajaxer-for-codeigniter-x.x.js" and "ajaxer-for-codeigniter-x.x-min.js" is released under the GNU General Public License v3. See "COPYING" for full license.

License information for CodeIgniter can be found at "demo/license.txt".

Copyright (c) 2012 CodeBinders Web Development Services LLP
Something went wrong with that request. Please try again.