AJAX the simpler way

March 9th, 2007 by Jeff Kee | Coding, Web Development | leave a response, or trackback

AJAX is the new cool phrase these days. I talked about it many times when I mentioned Facebook.com, and I am also implementing it in my newest project. In any case, while I was getting the code written out, I ran into small AJAX related errors (such as faulty headers, missing parameters or the status not updating etc.) and I just got sick of it. And then I found this simple method to make AJAX a lot simpler. Here is the website address :

http://www.openjs.com/scripts/jx/

Want to know more about how this works?

This website will provide you with the jx codebase/library that you can simply call into from your HTML pages, and the rest of the AJAX calls are simplified - you just put in the file, parameters, and define what action to take with the AJAX result, and it does it all for you. It basically extends your Javascript codebase to include an AJAX function in a sense. It saved me a lot of time and reduced my headaches. Here is a sample line of code that I put in - look how simple it is.

In case you wondered what AJAX was and how exactly it works, I will show you a diagram I drew for my client to let him understand how AJAX works.diagram-of-ajax-copy.jpg

AJAX - Where and how to use it

Why Facebook is better than MySpace

Also, if you want to get neat looking animated GIFs to show while your AJAX loads, check out this site.

RSS feed | Trackback URI

2 Comments »

Comment by Tyler Ingram
2007-03-10 18:08:31

I have a couple of web apps at work that I’ve coded with some ajax. Just some on-the-fly updates for statistics (production counters) and it works really well. Though with IE I needed to disable the Cache feature else the page never updates properly. I suppoes I could tell the browsers always to ignore the cache version of the sites via php’s Header() function.

aJax helps sites be more interactive, like hotmail Live which allows you to drag email messages into the various folders etc.

*shrug* :) I like it even though it has been around for a while, people seem to be using it more often now.

Comment by Jeff Kee
2007-03-10 18:12:58

Tyler :

As for the caching of files on AJAX, that’s not a browser issue - but it’s a server issue.

When my ajax file hits the PHP file, it’s all done on the server side - IE caches have NOTHING to do with it.

The server occasionally makes a mistake too. This is how you prevent it :

put a random string there all the time.

ajaxhit.php?rand=< ?php echo rand(1,1000000);?>

Something like that. That way the server will hit the file instead of relying on the cache each and every time.

 
 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Trackback responses to this post