tags:

views:

26

answers:

1

Hi all,

It's not that I'm not familiar with the concept but I'm wondering about what is the best approach when you are creating applications supporting ajax userexperience.

I mostly use ajax with jQuery but also when I want to load information without a pagerefresh. As you will probably know, the XmlHttp Object and the ResponseText provides a nice and easy way to execute a script in the back and display the results e.g. a div.

A bit of a downside of this approach is that its hard to see the actual generated sourcecode. I often take a look at the sourcecode to see if the expected parameters are correctly provided to e.g. formelements.

So I'm curious, what is your approach for creating ajax-data-load functionality? Is it just by the ResponseText property?

Feel free to join the discussion since I'm very willing to learn from you all.

Ben

+1  A: 

Having manually crafted XmlHttpRequest objects for a while, I now use jQuery for all my AJAX-ified stuff. It gives you much better control while coding less.

If you use Firefox, get yourself the Web Developer Toolbar. It has a cool feature called "view generated source code" which generates the HTML code that the browser knows about in the current document as it stands, so it includes the HTML sent back by your AJAX requests.

Also I make it a rule to always tell the user you're loading something rather than relying on the browser to tell them (like Gmail's "Loading" text in the corner for instance.)

Andy Shellam
Does jQuery also provide you with functionality to load page data? I have the webdeveloper toolbar.. I only used it for CSS and javascript errorchecking ;) I'll check out that feature too! And about your rule: I totally agree with you, it's actually one of my mainreasons for starting learning ajax.
Ben Fransen
@Ben Fransen - Also grab the FireBug extension, it's tremendously helpful for this area.
Nick Craver
@Ben - I assume by "page data" you mean loading page content via AJAX like you appear to be doing using XmlHttpRequest? If so then yes - check out the AJAX functionality: http://api.jquery.com/category/ajax/ I used it once and never looked back :)
Andy Shellam
@Nick, I have that one installed too. As well as YSlow, it's a nice tool to check the performance of the websites you're building.@Andy, I'm gonna take a look at it. You're right about me using the XmlHttpRequest object for that purpose.
Ben Fransen