PDA

View Full Version : Multiple Ext.util.JSONP.requests possible?



scriptPanda
16 Feb 2011, 7:10 AM
Hello,

I created a container that houses Twitter, Delicious and Tumblr(each has its own panels) and I use segmented buttons to get to each one. However, in order to this, I make Ext.util.JSONP.requests for each one. I started with Twitter, and it worked. When I started making a JSONP request for Delicious, it wouldn't load. It only sees the request for Twitter. When I commented out the request function for Twitter, Delicious started to work. It's like it can only handle one request at at time. Is this the case? Is it possible to make 3 JSONP requests or is there a way to make all three social media execute at the same time?

Example of my code for Twitter:

var refresh = function()
{
Ext.util.JSONP.request({
url: 'http://api.twitter.com/1/statuses/user_timeline/user.json',
params: {
count: 30,
include_rts: 1,
include_entities: 1,
callback: 'Callback'
}}
);
}

Callback = function(data)
{
var tList = data;
twitterPanel.update(tList);
}

Hope you could help me out. Thanks!

steve1964
16 Feb 2011, 9:45 AM
Hi, the json request are asynchronous request, so before display data that depends on this request make sure the data are loaded. You have to do 3 request.

headkit
2 Sep 2011, 12:56 AM
did you solve your problem?

eyalfx
16 Sep 2011, 7:20 AM
Same problem here.
It seems like the first call works correctly, and other calls after that just go into the queue.

eyalfx
16 Sep 2011, 7:36 AM
I just found the fix in a different post (http://www.sencha.com/forum/showthread.php?136535-Multi-calls-to-JSONP-request-method&p=649717#post649717).
basically, before you call Ext.util.JSONP make sure to set current to null.

Ext.util.JSONP.current = null;