Currently I’m editing a string, query, to pass to my .getJSON function. Its starting to get messy, and I’m wondering if there is a better way to pass parameters in javascript?
var twitter = {
query: "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=" + user_name + "&count=" + count + "&callback=?",
tweets: 3
};
$.getJSON(twitter.query,
function(json) {
console.log(json);
}
});
})
$.getJSON()optionally accepts a data argument which will build that string for you: