jquery - JSON internet explorer problems -


i using gallerycms outputs json feed images captions etc. using separate script parse json:

(function( $ ) {   $.fn.gallerycms = function( options ) {      var settings = $.extend({       url : '',       theme : '',     }, options);      var $this = $(this);      return this.each(function() {        if (settings.url.indexof('/myfeed/') > -1) {         alert('only album feeds supported galleria.')       } else if (settings.url.indexof('/feed/') > -1) {         parsealbum();       }      });      function parsealbum() {         $.getjson(settings.url,                  function(data) {         $.each(data.images, function(key, image) {           $($this).append('img src=<a href="' + image.url + '"><img data-title="' + image.caption + '" src="' + image.thumb + '" /></a>');         });          galleria.loadtheme(settings.theme);         galleria.run($this);       });     }    }; })( jquery ); 

within html document use set script:

$(document).ready(function() {       $('#galleria').gallerycms({         url : 'http://www.paulgubaphoto.com/gallerycms/index.php/api/feed/json/e2b740b7-9ab1-11e1-ae3d-0022192d6244',         theme : '/galleria/themes/twelve/galleria.twelve.min.js'       }); 

so works chrome, firefox, safari, mozilla no love internet explorer. can find here: www.paulgubaphoto.com/index-test.html. rank beginner please type , clearly.

paul

in document.ready function call initialize gallerycms using web service url http://paulgubaphoto.com/gallerycms/index.php/api/feed/json/3e346db5-93b0-11e1-ae3d-0022192d6244. request coming http://www.paulgubaphoto.com/index-test.html. ie seeing "www.paulgubaphoto.com , "paulgubaphoto.com" 2 different sites. means (in ie @ least) web service request subject same origin policy (see origin determination rules) , require use of jsonp. if change domain of url in browser address bar match domain part of web query url works (at least on version of ie9).

in order avoid need use jsonp should try define gallerycms web service url follows:

$(document).ready(function() {       $('#galleria').gallerycms({         url : 'http://' + document.domain + '/gallerycms/index.php/api/feed/json/3e346db5-93b0-11e1-ae3d-0022192d6244',         theme : '/galleria/themes/twelve/galleria.twelve.min.js'       }); 

that way don't have worry such issues.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -