#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    204
    Rep Power
    2

    Jquery JSON & Each not working in IE


    Hi. I have the following code which gets data from an external json, all working fine on firefox. But on IE it shows nothing.

    Any ideas?

    ( i named it myjsonfile.json for privacy purposes )

    Code:
    <script>
    $(document).ready(function(){
        $.getJSON('http://myjsonfile.json', function(data) {
    		$.each(data.Parkings11.parkings, function() {
    		    $('body').append('<p>' + this.description + ' : ' + this.availableCapacity + '</p>');
    		});			 
    	});
    });
    </script>
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,301
    Rep Power
    7170
    First determine whether the problem is with the getJSON call, with your each call or with the statement inside the each call.
    * Make sure myjsonfile.json is being hosted on the same domain as the page that contains that JavaScript code
    * Make sure data contains the structure and data that you expect it to
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    204
    Rep Power
    2
    Originally Posted by E-Oreo
    First determine whether the problem is with the getJSON call, with your each call or with the statement inside the each call.
    * Make sure myjsonfile.json is being hosted on the same domain as the page that contains that JavaScript code
    * Make sure data contains the structure and data that you expect it to
    Well it does because it works on Firefox. It's only Internet Explorer that's giving a blank page.

    I uploaded the page to http://notflip.be/gent
  6. #4
  7. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,301
    Rep Power
    7170
    Originally Posted by E-Oreo
    * Make sure myjsonfile.json is being hosted on the same domain as the page that contains that JavaScript code
    ^^
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    204
    Rep Power
    2
    Originally Posted by E-Oreo
    ^^
    hmh don't really understand. So ie requires the file to be internal? Im getting the file from an external source..

IMN logo majestic logo threadwatch logo seochat tools logo