ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Tutorial: AJAX with jQuery

May 27, 2008 5:37pm

Subscribe [7]
  • #1 / May 27, 2008 5:37pm

    Michael Wales

    2070 posts

    I’ve completed my latest tutorial, CodeIgniter AJAX with jQuery. Feel free to check it out as well as download the small library that goes along with it Request.

    Request is a CodeIgniter library that determines if a request was made via AJAX. This makes it very easy to stick to DRY principles and utilize the same controller methods no matter how a request was initiated.

  • #2 / May 27, 2008 6:27pm

    thurting

    213 posts

    I haven’t looked at your source, but it sounds pretty cool.  Have you seen the ContextSwitch and AjaxContext helpers contained in the Zend Framework?  You should check them out.

  • #3 / May 27, 2008 8:08pm

    Derek Allard

    3168 posts

    great minds and all…

    Buried in Bamboo is ajax_helper.php… which isn’t currently getting used.  Here’s the code

    function isAjax()
    {
        return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
    }

    Look familiar 😉

    If I was going to use it, I’d convert it to use

    $this->input->server()
  • #4 / May 28, 2008 1:19am

    Michael Wales

    2070 posts

    Yeah - it’s a really common way to check if AJAX is the method in which the request was sent. I tried to do a bit of research, to determine which Javascript libraries supported this - as it is a header set by the library itself so it could be easily unsupported - alas, I ran out of time and since I only use jQuery I ran with it for the time being. Just something else to put on my list of to-dos.

    Of course, I wouldn’t be surprised if it becomes a standard and FF3 detects the AJAX request and assigns this header from the browser (IE13 will do the same).

  • #5 / May 29, 2008 2:37am

    Michael Wales

    2070 posts

    It’s not really an API… but, Derek outlines a lot of concerns on his blog and I pretty much agree with those (I made a comment about it as well). It wouldn’t stop me from using the service on a lot of different sites, but if I had something that was absolutely critical to bringing in lots of money - I’d rely on my own hosting for these libraries.

  • #6 / Dec 22, 2008 12:28am

    daniel.affonso

    23 posts

    Michael, where’s can I find this tutorial?
    Thanks in advance.

  • #7 / Dec 22, 2008 6:17pm

    Bramme

    574 posts

    Hey Michael, with your site update, this tutorial is online :( I wanted to follow it to figure some things out. Any way of putting it back online?

  • #8 / Dec 23, 2008 11:41pm

    OliverHR

    137 posts

    Michael please put again you old site content available, are a must read for all.

    Thanks.

  • #9 / Jan 02, 2009 7:36am

    featureBlend

    35 posts

    Nice tutorial, but i couldn’t reach it.

  • #10 / Feb 13, 2009 4:34pm

    sl3dg3hamm3r

    223 posts

    Hey Michael

    Will you put this great tutorial back on by any chance? As far as I remember it was the best tutor I read regarding CI and AJAX…

    Sl3dg3

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases