In case anyone uses a standard .aspx page for this and has the same
issue, I changed the content type in either of these ways for the page
providing the text and it worked:
Response.ContentType = "text/plain";
Response.ContentType = "application/x-javascript"; // what flickr uses
On Oct 15, 7:33 pm, noob <[EMAIL PROTECTED]> wrote:
> I feel like an idiot but I can't get getJSON to work in firefox - can
> anyone give me a pointer?
>
> here is the code - top function is the jquery documentation demo code
> which works in IE and firefox. bottom version never hits the alert:
>
> $(document).ready(function(){
> $.getJSON("http://api.flickr.com/services/feeds/
> photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
> function(data){
> $.each(data.items, function(i,item){
> $("<img/>").attr("src",
> item.media.m).appendTo("#images");
> if ( i == 3 ) return false;
> });
> });
>
> $.getJSON
> (
> "http://localhost/bnf_dev/pages/ec_api.aspx",
> function(data){
> alert(data);
> }
> );
> });
>
> the .aspx page generates this string:
>
> ({"Year":1980,"Company":"Ford","Model":"Taurus"})
>
> It doesn't validate inhttp://jsonlint.com/but neither does the demo
> from flickr. When I change the round to square brackets to make it
> validate it doesn't help.
>
> Someone posted that if the json object isn't valid to jquery, it fails
> silently. IE I can access the individual data (I know I'm just
> alerting the object above but it does let me access the properties.
> I've traced it in firebug and it looks like its going through - the
> ajax call is made the same way the flckr version is - somewhere in the
> depths of the jquery code i'm sure it's different but i haven't found
> it yet.
>
> Any help greatly appreciated.
>
> Gray