{"id":286,"date":"2011-06-26T13:04:47","date_gmt":"2011-06-26T13:04:47","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=286"},"modified":"2011-06-26T13:21:14","modified_gmt":"2011-06-26T13:21:14","slug":"jquery-dialog-load-external-url","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/jquery-dialog-load-external-url\/","title":{"rendered":"jQuery dialog load external URL"},"content":{"rendered":"<p>The solution is simple, but coming to it was quite the opposite. After browsing many posts which don&#39;t deal with the fact that external URL can&#39;t be loaded via AJAX (ruling out the $.load() method), I came up with this simple solution:<\/p>\n<p><code>$(&#39;&lt;iframe src=&quot;http:\/\/www.sitekickr.com\/&quot; width=&quot;300&quot; height=&quot;300&quot; \/&gt;&#39;).dialog({ modal: true, width: 300, height: 300});<br \/>\n\t<\/code><\/p>\n<p>Creating an IFRAME on the fly prevents you from bloating your HTML, while allowing you to load external content.<\/p>\n<h3>Possible Issue<\/h3>\n<p>You may encounter an IFRAME that is &quot;stuck&quot; at a certain width, or doesn&#39;t fill the dialog completely. It seems that wrapping the IFRAME in a DIV resolves this issue.<\/p>\n<p><code>$(&#39;&lt;div&gt;&lt;iframe src=&quot;http:\/\/www.sitekickr.com\/&quot; width=&quot;300&quot; height=&quot;300&quot; \/&gt;&lt;\/div&gt;&#39;).dialog({ modal: true, width: 300, height: 300});<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The solution is simple, but coming to it was quite the opposite. After browsing many posts which don&#39;t deal with the fact that external URL&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"amp_status":""},"categories":[5,25],"tags":[86],"_links":{"self":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/286"}],"collection":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/comments?post=286"}],"version-history":[{"count":3,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/286\/revisions"}],"predecessor-version":[{"id":290,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/286\/revisions\/290"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}