I’m trying to return some data from twitter’s JSONP results. I’m then trying to customize the response and prepend my own “ID” parameters so I can use it as a key in a key/value pair when I transform it back into JSON. I’m kind of confused as to why the jQuery prepend function is not working for this case.
here is a short bit of code i’m working with
$.getJSON('http://api.twitter.com/1/statuses/user_timeline.json?user_name=twitterapi&callback=?', function(data) {
$.each(data, function(i) {
$(data[i].id_str).prepend("id:"); //foobar, doesn't prepend anything
});
PS. I know this isn’t the formatted result I ultimately want but the question is about prepending.
How does that json result look like?
Aren’t you trying just to do some string concatenation? Maybe this helps: