Page 1 of 1

jquery and $.getJSON - mozilla is working great, ie chokes

Posted: Thu May 24, 2007 6:56 pm
by Luke
I'm trying to use jquery to "get" a url and parse the json it returns. In firefox, it works seamlessly. Internet explorer chokes (what a shock!) Is there a specific header that needs to be returned by the url? Is there anything wrong with my json?

Code: Select all

{ 'img':'/mm5/public/images/products/100333.jpg' ,'bup':'/mm5/public/images/products/bup/100333.jpg' } 
How about my javascript?

Code: Select all

$(function(){

        $("#product-colors .loading span").ajaxStart(function(){

          $(this).html('Loading...');
          $(this).fadeIn('fast');

        });

        $("#product-colors .loading span").ajaxComplete(function(){

          $(this).fadeOut('slow', function(){

            $(this).empty();

          });

        });

        $("#product-colors .loading span").ajaxError(function(){

          $(this).html('<span class="error attention">Sorry, an error has occured</span>');
          $(this).fadeIn('fast');

        });

        $('#product-colors input:radio').focus(function(){

          var code = $(this).attr('value');

          $.getJSON("/widget/image-verify", {'Product_Code':code, bup:'1'}, function(json){

            if (json.img != 'false')
            {

              $('#main_photo img').attr('src', json.img);

            }

            if (json.bup != 'false')
            {

              $('#main_photo a.thickbox').attr('href', json.bup);

            }

          });

        });

      });
Image I HATE IE

Here's the url to the page:
http://store.tarmadesigns.com/product/a ... -wristband

Try toggling the color. It works so well in firefox. In Internet explorer sometimes the content on the right overlaps the image (WTF??) and the image swap is not working.

Posted: Thu May 24, 2007 8:43 pm
by Kieran Huggins
Firefox is quite a bit more forgiving than IE in many ways!

instead of

Code: Select all

if (json.bup != 'false')
try

Code: Select all

if (json.bup != false)
(same for json.img)

Posted: Thu May 24, 2007 8:48 pm
by Luke
I was hoping you'd show up here! :D I tried that. It's returning the string 'false' on failure. This is the strangest thing. Did you look at the site? See how one table cell is overlapping another? WTF? I have NEVER seen that happen. I plan on converting it to an all-css layout, but for the time being I'd just like it to work! :(

EDIT: wait, maybe I didn't try that... hang on.

EDIT AGAIN: Hmm... it appears that in IE it isn't sending the correct parameters or something, because it's returning false when it should return the path. :( I will have to tinker some more.

Posted: Thu May 24, 2007 9:26 pm
by Luke
Strange, it turns out IE didn't like the get method for some reason. I tried post and it works fine. But it's still doing that annoying table cell overlap thing. Anybody know what could be causing that?

Posted: Fri May 25, 2007 10:51 am
by Luke
It appears that the table cell overlap only happens after you click the image and it opens a thickbox (google it). So I guess thickbox is causing this problem some-how. I guess I'll try laying it out with CSS and see if that is handled better.

Re: jquery and $.getJSON - mozilla is working great, ie chok

Posted: Fri May 25, 2007 12:43 pm
by RobertGonzalez
The Ninja Space Goat wrote:Image I HATE IE
+100. Amen to that!