Hi,

I'm currently trying to port over a clientcide JsonP request to the
new MooTools More Request.JSONP. My old code worked fine, as below:

                var myJsonP = new 
JsonP('http://twitter.com/statuses/user_timeline/
user_name.json',{
                        data: {
                                count: '1'
                        },
                        onComplete: function(data) {
                                data = data[0];
                                var el = $('twitter-post');
                                el.innerHTML = 'Twitter: ' + data.text;
                                el.href = 
'http://twitter.com/user_name/status/' + data.id;
                        }
                }).request();

My new piece of code, using Request.JSONP, looks like this:

                var myRequest = new Request.JSONP({
                        url: 
'http://twitter.com/statuses/user_timeline/user_name.json',
                        data: {
                                count: '1'
                        },
                        onComplete: function(data) {
                                data = data[0];
                                var el = $('twitter-post');
                                el.innerHTML = 'Twitter: ' + data.text;
                                el.href = 
'http://twitter.com/user_name/status/' + data.id;
                        }
                }).send();

This returns a type error of: Result of expression 'data' [undefined]
is not an object.

Apologies if I am being stupid here, or missing something glaringly
obvious - but I am having trouble finding help in the docs?

Many Thanks,

Alex

Reply via email to