ForumsDevelopers$.getJSON fails


$.getJSON fails
Author Message
Doubted Edwardo

Posted: Feb 09, 2011
Score: 0 Reference
Hey, does anyone use jQuery to get info from toodledo? I've found that the built in ajax query always fails with a No Transport error.
Jake

Toodledo Admin
Posted: Feb 10, 2011
Score: 0 Reference
This has nothing to do with jQuery or Toodledo. There is a built in security mechanism in all web browsers that prevents javascript from accessing resources on other domains.

Read here: http://jquery-howto.blogspot.com/2009/04/cross-domain-ajax-querying-with-jquery.html
Doubted Edwardo

Posted: Feb 10, 2011
Score: 0 Reference
Thanks for the reply. I don't think this is the problem as using an XMLHttpRequest object works fine and the example on the jQuery page which loads data from flickr works too. I'm wondering if the problem is from the syntax jQuery uses in the URL it sends to toodledo. The URL passed to flickr is "http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?" and the query string is {tags: "cat",tagmode: "any",format: "json"}. jQuery then turns this into "api.flickr.com/services/feeds/photos_public.gne?jsoncallback=jQuery15030959770146949384_12973796825 94&tags=cat&tagmode=any&format=json&_=1297379682628". Is this structure not recognised by Toodledo?
Jake

Toodledo Admin
Posted: Feb 10, 2011
Score: 0 Reference
Can you please post a link to the flickr example you mentioned.
Doubted Edwardo

Posted: Feb 10, 2011
Score: 0 Reference
http://api.jquery.com/jQuery.getJSON/
Jake

Toodledo Admin
Posted: Feb 10, 2011
Score: 0 Reference
Well, you learn something new every day.

They use something called JSONP to do that, and our API would need to provide explicit support for this, which we don't yet because I didn't know about it. I'll put it on the to-do list.

Thanks for pointing this out.
Doubted Edwardo

Posted: Feb 11, 2011
Score: 0 Reference
No Problem. I guess I'll have to use an XMLHttpRequest to get tasks then, or use the method you pointed out earlier?
You cannot reply yet

U Back to topic home

R Post a reply

To participate in these forums, you must be signed in.