JAM for your Web Sandwich

So you have been giving so much Ajax love that you pass more XML than anything else. It is time to lean up your XML usage and get native. What do we call this jungle fever? I personally refer to it as JavaScript Append Method – JAM. You are already using JSON right? Right?? (don’t answer just do it) If not, forget all the markup overhead of XML. If you are passing JSON back to the browser, simply JAM your response object on the end of the DOM. Like this:

$.fn.json = function jam( url ) {
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = url;
$('head',document).append( script );

Yes that is a jQuery plugin. Even better JAM your JSONP on the end of your DOM.

Is any of this new? No. It is, however, time to revisit the way you are thinking. Ajax was a great buzz word in it’s time. Just like the ‘Push’ of the mid 90’s. Reflect if you will on your site, webapp, or Web page. If you have been implementing Ajax, have you spent a lot of time taking advantage of modern JavaScript? Conversely, are you using a snazzy library for doing your Ajax? If the former has been your focus, why not make it your goal to move from XML (a great exchange format for non-web applications) to a more consistent, less verbose approach. Then take your data and just JAM it in a page. If you are using a library. I challenge you to find the fastest library out there. Then look under the hood to see what makes it tick. I bet it is JSON, maybe even JSONP. Heck, I bet it just could be JAM.

This has made my life simpler. In fact I have a nice PQ&J sandwich in the works. I will keep you posted.

JAM for your Web Sandwich

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s