{"id":574,"date":"2005-12-19T11:05:51","date_gmt":"2005-12-19T16:05:51","guid":{"rendered":"http:\/\/www.ashleyit.com\/blogs\/brentashley\/?p=574"},"modified":"2005-12-19T13:00:56","modified_gmt":"2005-12-19T18:00:56","slug":"json-trumps-ajax-for-mashups","status":"publish","type":"post","link":"https:\/\/ashleyit.com\/blogs\/brentashley\/2005\/12\/19\/json-trumps-ajax-for-mashups\/","title":{"rendered":"JSON trumps Ajax for Mashups"},"content":{"rendered":"<p>I&#8217;ve spent a lot of time over the years playing with different methods of having a web page get data from the server without refreshing the page.  One of my major criteria has been to find a method that works across all browsers.  A few different methods have cropped up over time, following an evolutionary path.<\/p>\n<p>In 1998, I used <a href=\"http:\/\/msdn.microsoft.com\/library\/default.asp?url=\/library\/en-us\/rmscpt\/Html\/rmscpt.asp\">Microsoft Remote Scripting<\/a>, which used a Java applet for its transport layer.  Java later became a problem, since it&#8217;s blocked by firewalls and no longer automatically supported by all of the main browsers.<\/p>\n<p>In 1999 I started experimenting with frames, then a hidden Iframe, which I used in my <a href=\"http:\/\/www.ashleyit.com\/rs\">JSRS<\/a> library in 2000.  Iframes have become <a href=\"http:\/\/www.ashleyit.com\/blogs\/brentashley\/archives\/000443.html\">deprecated <\/a>as of the XHTML specification, and <a href=\"http:\/\/codinginparadise.org\/weblog\/2005\/08\/ajax-tutorial-tale-of-two-iframes-or.html\">browser history<\/a> can be affected by their use, making this workable but suboptimal.<\/p>\n<p>In 2000 I wrote <a href=\"http:\/\/www.ashleyit.com\/rs\/rslite\/\">RSLite<\/a> which uses a client-side image object and a cookie.  This works across pretty well all browsers but has limited value due to url and cookie length limits.<\/p>\n<p>I started to use and promote Microsoft&#8217;s <a href=\"http:\/\/www.4guysfromrolla.com\/webtech\/110100-1.shtml\">XMLHttp<\/a> object <a href=\"http:\/\/tinyurl.com\/cxp9f\">fairly early on<\/a>, but its limitation to IE and at that time only beta Mozilla made it not-ready-for-primetime.  It has since come into its own in the form of <a href=\"http:\/\/www.ajaxpatterns.org\">Ajax<\/a>, however there are still <a href=\"http:\/\/getahead.ltd.uk\/ajax\/cross-domain-xhr\">cross-domain scripting<\/a> limitations, which are an impediment to the kind of Web 2.0 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Mashup_(web_application_hybrid)\">mashups<\/a> that are some of the most compelling new uses of browser technology.<\/p>\n<p><a href=\"http:\/\/www.dotvoid.com\">Danne Lundqvist<\/a> was amongst the first to <a href=\"\"http:\/\/www.dotvoid.com\/view.php?id=13\">talk about<\/a> the idea of using dynamically-generated script tags to send and receive data.  In conjunction with <a href=\"http:\/\/www.crockford.com\">Douglas Crockford<\/a>&#8216;s <a href=\"http:\/\/www.crockford.com\/JSON\/index.html\">JSON JavaScript Object Notation<\/a>, this method has recently been promoted by Yahoo in their <a href=\"<http:\/\/ws1.inf.scd.yahoo.com\/javascript\/\">Javascript Developer Center<\/a> as a way to perform cross-domain data transmission.<\/p>\n<p>Full coverage of the method can be seen on <a href=\"http:\/\/www.theurer.cc\/blog\/2005\/12\/15\/web-services-json-dump-your-proxy\/\">Dan Theurer<\/a>&#8216;s blog.<\/p>\n<p>I am beginning to think that the combination of JSON and <a href=\"http:\/\/ajaxpatterns.org\/On-Demand_Javascript\">On-Demand-Javascript <\/a> holds a great deal of promise:<\/p>\n<ul>\n<li>Great cross-browser compatibility<\/li>\n<li>It is not a hack.  Cross-domain script tags are a designed-in browser feature.  DOM manipulation is central to modern browsers<\/li>\n<li>JSON is a great compact object notation, native to JavaScript yet already implemented in many server-side languages and easy to do for others<\/li>\n<\/ul>\n<p>It may be just another crayon in the box, but I think it&#8217;s going to get a lot of sharpening now that Yahoo is actively promoting JSON.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve spent a lot of time over the years playing with different methods of having a web page get data from the server without refreshing the page. One of my major criteria has been to find a method that works across all browsers. A few different methods have cropped up over time, following an evolutionary [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","footnotes":""},"categories":[2],"tags":[],"class_list":["post-574","post","type-post","status-publish","format-standard","hentry","category-ajax"],"_links":{"self":[{"href":"https:\/\/ashleyit.com\/blogs\/brentashley\/wp-json\/wp\/v2\/posts\/574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ashleyit.com\/blogs\/brentashley\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ashleyit.com\/blogs\/brentashley\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ashleyit.com\/blogs\/brentashley\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ashleyit.com\/blogs\/brentashley\/wp-json\/wp\/v2\/comments?post=574"}],"version-history":[{"count":0,"href":"https:\/\/ashleyit.com\/blogs\/brentashley\/wp-json\/wp\/v2\/posts\/574\/revisions"}],"wp:attachment":[{"href":"https:\/\/ashleyit.com\/blogs\/brentashley\/wp-json\/wp\/v2\/media?parent=574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ashleyit.com\/blogs\/brentashley\/wp-json\/wp\/v2\/categories?post=574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ashleyit.com\/blogs\/brentashley\/wp-json\/wp\/v2\/tags?post=574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}