시나리오 :
$('.media').on("click", function (){
var id = $(this).find('.media-id').text();
$.getJSON('/review/latestReview/' + id, function (review) {
console.log(review);
var str1 = "<h5>"+review.title+"</h5>" +
"<span>"+review.content+"</span>";
});
$(this).find('.media-body-contents').html(str2); .......(1)
});
$('.media-body').on("click", function (){
var thisBody = $(this);
var id = $(this).find('.media-id').text();
var str1="hello";
alert("outerFirst: "+str1);
$.getJSON('/review/latestReview/' + id, function (review) {
str1 ="goodday";
alert("innerFirst: "+ str1);
console.log(review);
str1 = "<h5>"+review.title+"</h5>" +
"<span>"+review.content+"</span>";
console.log(str1)
alert("innerSecond: "+str1);
//$(this).find('.media-body-contents').html(str1); .......(2)
$(thisBody).find('.media-body-contents').html(str1); .......(3)
});
alert("outerSecond: "+str1);
});
이것 때문에 많은 시간을 소비했다. 그래도 해결해서 가뿐하다. 하하.