Featured Posts

Codeigniter Pagination Part 3 OK so we have now covered setting up Codeigniter Pagination and passing some simple data through it. We have also managed to add categories to our posts to make it a little...

Readmore

Codeigniter Pagination Part 2 So leading on from the last screencast we now have some simple data being pushed through the pagination library. Now were going to look at adding categorys to our posts...

Readmore

Codeigniter Pagination Part 1 One of the biggest things I see being asked around the codeigniter forums & IRC channel is pagination. So I have decided to create a set of tutorials from basic setup...

Readmore

Codeigniter Preparation Hopefully if I can keep my promise and will be rolling a set of screencast on this site and part of them will be to do with the Codeigniter Framework. I though it would...

Readmore

Radio Button Replacement With Style I thought I would kick off this blog with a short tutorial on how you can make form radio buttons look and feel allot more interesting. A recent job required the user to...

Readmore

Web Lee Rss

Simple Jquery Ajax with Codeigniter Part 4

Posted on : 10-06-2009 | In : Codeigniter, Jquery, Screencasts

18

Hopefully by now you will have had a better understanding on how to use Jquery with Coedigniter. We have looked at the $.post & $.get request so far and have passed some simple data between them.

In this the last part of this series we will take a look at the $.ajax  request. The $.ajax request is very powerfull and far to much to talk about in this one screencast so I would strongly suggest you take a look at the JQuery Documentation


Screencast Time: 19:18

Download Example Files here .

In a future screencast we will have another look at the Ajax request on how we can make better use of it for multiple ajax request throughout your site. So be sure to follow us by the RSS feed or Twitter.

Thank you for tunning in :-) .

Comments (18)

You have really interesting screencasts on CodeIgniter, thanks for them.

I’m really curious about” which programmng editor are you using?

Hi Peter

Been asked this one a few times now :-) .

Please ckick here for ide used.

tanks for the CI series keep it up . Really good work .

Peter: I think he is using TextMate with the proper “Bundles” installed. Excellent tutorials… so well done. Odd thing happens though… as soon as this is added:

window.setTimeout( function(){ }, 3000);

It stops showing the loading div in Firefox all together. It worked perfect up until then and even after in Safari… strange.

Thanks for this lecture

Nice tutorial, really well done! Help me speed up my development .

I use Web Firefox Development add ons ( https://addons.mozilla.org/en-US/firefox/addon/60) which gives you ability to disable caching

One question:

in controller is if all ok
echo 1;

I want do redirect to another controller/function
and this not working. new, redirected controller/view is echoed inside old ajaxform…
(if user roll_id is 90, then redirect to another controller, if 85 then stay this one, old controller. I think I can do echo anchor(another controller) but I want to send directly to another. How I can implement this, with this simple ajax/jguery controller? or this is impossible?)

can I do redirect if all ok and how?

Hi

If you are saying will an ajax request jump functions then the answer is no. But instead write your code to call other functions instead of redirecting.

ie

function name($string)
{
if($string != "Bob")
$this->function($string)
exit;
}

Hope it helps

Hi,

Great screencasts, only I have a question.
I have 2 links and when you click on them I send a ajax request, this is working fine thx to you, only I want to disable the link where i clicked on and then the other link must be enabled and visa versa.
So that you cant click on the link that you already clicked on, because now I can click thousands of times on the same link and always its sending a request.

I hope you can help me.

Greetz

Well using the callback success disable the link ie $(’a.linkclass’).click(function(event){ event.preventDefault() }) or remove it from the DOM.

Hope this helps a little.

Thx, for the quick comments back, I have solved it by using the jquery blockUI plugin.
I remember that you use it too, but that was when I already post the comment.

Greetz

Great tutorial, very easy to follow for a begginer like me.
I will definitely incorporate your AJAXing techniques in my upcoming project.

Thank you for taking the time to put these tutorials together, this is good stuff!

I have a CodeIgniter (ExpressionEngine) project in the works so this will come in handy, cheers!

very nice, thanks :)

thanks , I learn much form this.

Thx a lot Lee!

I’ve watched all the parts and it clarified a lot to me the way to use ajax on CI, very well done! Keep up the good work bra!

Cheers!

Thanks a lot for the time you took to do these screencast.

thank you for your lecture.I study a lot.

Write a comment