JS / JQuery character problem
- by Jimmy Farax
I have a code which has a character that JS is not handling properly.
$(document).ready(function(){
$.getJSON("http://sjama.tumblr.com/api/read/json?callback=?",
function (data){
for (var i=0; i<data.posts.length; i++){
var blog = data.posts[i];
var id = blog.id;
var type = blog.type;
var photo = blog.photo-url-250;
if (type == "photo"){
$("#blog_holder").append('<div class="blog_item_holder"><div class="blog_item_top"><img src='+photo+'/></div><div class="blog_item_bottom">caption will go here</div></div>');
}
}
}); <!-- end $.getJSON
});
The problem is with this line:
var photo = blog.photo-url-250;
after "blog." it reads the "url" part weirdly because of the dash (-) in between.
What can I do to sort this problem out?