Archive

Posts Tagged ‘AJAX’

CodeIgniter, jQuery and Ajax

September 18th, 2008

I have read tens of articles on Ajax. I fully understand the philosophy behind it (or at least I would like to think so). However, until today I have found a way to execute specific function from specific class ba simply calling it from any type of link (button or regular link). Today I stumbled upon this excellent article from Michael Wales. This article is a demonstration of CodeIgniter’s cool architecture and URL handling. It is simply a thing of beauty.

Just imagine you create a link with href attribute like

http://somesiteofmine.domain/index.php/controlername/controlerfunction/

This link executes some Ajax call to controlername.php file containing controlername class and controlerfunction function.

And all it takes is a little jQuery like


$(document).ready(function() {
    $('#ajaxCallSampleLink').click(function(event) {
        event.preventDefault();
        $('#list').load(this.href);
    });

    $('#loading').ajaxStart(function() {
        $(this).show();
    }).ajaxStop(function() {
        $(this).hide();
    });

    $('#list').ajaxStart(function() {
        $(this).hide();
    }).ajaxStop(function() {
        $(this).show();
    });
 });

Please follow the link to Michael Wales original article in order to read full tutorial and download his original files.

CodeIgniter, jQuery , ,

Building Ajax form with jQuery

August 3rd, 2008

The greatness of JavaScript is… damn, why do I even bother. We all know what JavaScript can do. It brings life to your web site. If done right it can make your site more user friendly, accessible, functional and so on. In this example I’m gonna show you how to add Ajax into your web forms. I’ll be using my favorite JavaScript framework, jQuery.

Ajax with jQuery is extremely simple. If you browse to this url, you will clearly see supported methods for Ajax Requests and Ajax Events. I really like jQuery documentation. Seems very good organized. If you click on one of the method names, let’s say jQuery.ajax you will see 3 main navigation tabs at the top: Overview, Options, Example. Read more…

JavaScript, jQuery , , ,