0
我开发了使用JQuery获取JSON数据的工具,但问题是某些变量不会放置它们的值,并且我只能使用变量名。此代码为什么我不能在JQuery中获取变量值
$(document).ready(function(){
$('.HTML').each(function(){
var call = $.getJSON('http://test-khamsat-support-gig.blogspot.com/feeds/posts/default/-/Break?max-results=10&orderby=published&alt=json-in-script&callback=?',function(data){
var cont = data.version;
});
var th = $(this);
var b = th.html(),
a = b.match(/[^[\]]+(?=])/g);
if(a){
if(a[2] == 'one'){
th.append("<h1>'+cont+'</h1>")
}
}
});
});
,因为它里面的内容我blog饲料代码将只是在我的博客上运行
是一个跨域请求? –
首先,在ajax请求中,你不能这样做 - http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-ajax-call –
第二,因为'cont'是一个变量'th.append(“
”+ cont +“
”)' –