{"id":273,"date":"2009-01-09T00:06:21","date_gmt":"2009-01-09T05:06:21","guid":{"rendered":"http:\/\/www.eligrey.com\/?p=273"},"modified":"2025-11-10T16:24:11","modified_gmt":"2025-11-10T23:24:11","slug":"new-jdata-api","status":"publish","type":"post","link":"https:\/\/eligrey.com\/blog\/new-jdata-api\/","title":{"rendered":"New jData API"},"content":{"rendered":"<p><strong>Update<\/strong>: Please note that this information is obsolete and does not work with the new completely-rewritten jData host library.<\/p>\n<p>When not using the postMessage API but using the HTTP query parameters API, you used to have to use the &#8220;callback&#8221; parameter and do something like <code>callback=location.href=\"http:\/\/example.com\/%3Fvalue=\"+encodeURIComponent(jdata)+\"%26item=\"+locacation.search.replace\u2026<\/code> (and some code to figure out what item is being used) to be able to add support for browsers that support localStorage but not postMessage via server-side. I have simplified this by adding an &#8220;r&#8221; parameter. The r parameter is a URI that the jData frame will redirect to and you can include two different variables in the URI.<\/p>\n<p>The first parameter is <em>%i<\/em>, which is automatically replaced with the item being accessed. The second parameter is <em>%v<\/em>, which is the value of the item being accessed.<\/p>\n<p>Example: <a href=\"http:\/\/jdata.eligrey.com\/?get=personal.fullname&amp;r=http:\/\/example.com\/%3Fitem=%i%26value=%v\"><code>http:\/\/jdata.eligrey.com\/?get=personal.fullname&amp;r=http:\/\/example.com\/?item=%i&amp;value=%v<\/code><\/a><\/p>\n<p>This redirects to <code>http:\/\/example.com\/?item=personal.fullname&amp;value=Eli%20Grey<\/code> for me. If an item is not set, <em>%v<\/em> will either be null (Firefox &amp; Safari nightlies) or undefined (IE) depending on the browser, but as not to confuse with a string of &#8220;null&#8221; or &#8220;undefined&#8221;, I have it return an empty string when it is undefined or null.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: Please note that this information is obsolete and does not work with the new completely-rewritten jData host library. When not using the postMessage API but using the HTTP query parameters API, you used to have to use the &#8220;callback&#8221; parameter and do something like callback=location.href=&#8221;http:\/\/example.com\/%3Fvalue=&#8221;+encodeURIComponent(jdata)+&#8221;%26item=&#8221;+locacation.search.replace\u2026 (and some code to figure out what item is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[94,133],"class_list":["post-273","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-jdata","tag-projects"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pfpUD-4p","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/posts\/273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/comments?post=273"}],"version-history":[{"count":0,"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/posts\/273\/revisions"}],"wp:attachment":[{"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/media?parent=273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/categories?post=273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eligrey.com\/blog\/wp-json\/wp\/v2\/tags?post=273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}