我不知道如何在 Stackoverflow 中搜索这个问题,它提供了不同的解决方案,并且与我的问题无关。所以我会再次需要你们的帮助。
变量 obj 的值:
item.title = Title1 and Title2
item.description = Description1 and Description2
文件:
function test_pop() {
var fb_id = "xxxxxxxxxxxx";
var v_id = "xxxxxxxx";
$.post('http://mysite.com/myfile.php', {fb_id: fb_id, v_id: v_id}, function(data) {
var obj = $.parseJSON(data);
$.each(obj,function(index, item){
achievement = "You Obtained " + item.title + " " + item.description;
achievement_pop(achievement);
});
});
}
成就流行功能:
function achievement_pop(data) {
$("#achievement_popup").html(data).show(); //DIV that should show up
}
所以问题是,当 div 出现时,它只输出:
<div> <!-- Imagine that this content is inside a DIV -->
**You Obtained Title2 Description2**
</div>
但我的愿望输出是:
<div> <!-- Imagine that this content is inside a DIV -->
**You Obtained Title1 Description1**
**You Obtained Title2 Description2**
</div>
希望大家帮帮我,谢谢。