I’m playing around with a function and getting
b.createDocumentFragment is not a function (jQuery)
My function is
function tweetCount(url) {
$.getJSON("http://urls.api.twitter.com/1/urls/count.json?url="+url+"&callback=?", function(data) {
count = data.count
$(this).append(count);
})
}
I’ve tried lots of different way but can’t seem to find out why it doesn’t like “append”. “count” is a number and something like alert(count) works, but not append!
Any help?!
Alex
I don’t think that
thisis referring to what you think it is. Change$(this)to an explicit reference to the DOM element you want.Alternatively, you can define
thisby calling:Edit
Try this:
Or, to save space:
Edit 2:
Try replacing
tweetCountwith this: