displaying another html content in div on ajax success
- by Manish
gameLike.jsp
<div class="gameLikeStatus">
<a href="likeit" class="likeitlink">likeit</a>
</div>
var dataString = 'elementId='+ '<s:property value="id"/>'+ '&elementType=' + 'games';
$(document).ready(function(){
$('a#likeitlink').bind('click',function(event){
event.preventDefault();
$.ajax({
type: "POST",
url: "likeit",
dataType: "text html",
data: dataString,
success: function() {
$.post('isLiked',dataString, function(data) {
alert(data);//1
$('#gameLikeStatus').html(data);
});
}
});
});
});
in second.jsp contains a link
<a href="unlikeit" class="Unlikeitlink">likeit</a>
Here I am liking the element and after like it should display
<a href="unlikeit" class="Unlikeitlink">likeit</a>
instead of
<a href="likeit" class="likeitlink">likeit</a>
at
<div class="gameLikeStatus"></div>
in gameLike.jsp, alert(data);//1 is showing
<a href="unlikeit" class="Unlikeitlink">likeit</a>
this data but
$('#gameLikeStatus').html(data);
showing nothing.
How to resolve this?