<script type="text/javascript">
var dataString2 = 'run=captchagood&comment=' + comment;
$.ajax({
type: "POST",
url: "process.php",
data: dataString2,
dataType: "json",
error: 'error',
success: function (data) {
if (data.response === 'captchasuccess') {
$('div#loader').find('img.load-gif').remove();
$('div#loader').append('<span class="success">Thanks for your comment!</span>');
$('div#loader').hide().fadeIn('slow');
$('span.limit').remove();
$('ol#commentlist').prepend(data.comment);
$('input#submit-comment').unbind('click').click(function () {
return false;
});
};
}
});
</script>
I need the above to append the below code to a comment list on the current page.
COMMENT-ID-NUMBEER = this will be part of the json response above
COMMENT-POST-DATE = this will be part of the json response above
COMMENT-TEXT = this will be part of the json response above
USER-GENDER = this is in the PHP session
USER-IMAGE-URL = this is in the PHP session
USER-NAME = this is in the PHP session
Here is what I need to insert into the page, the below code but with the items I list directly above to be inserted into the proper locatons as well.
<ol class="commentlist" id="commentlist">
<!-- START Comment block -->
<li class="thread-even" id="COMMENT-ID-NUMBEER">
<div class="photocolumn">
<div class="imageSub" style="width: 100px;">
<img class="USER-GENDER" src="USER-IMAGE-URL" width="100"/>
<div class="blackbg"></div>
<div class="label">USER-NAME</div>
</div>
</div>
<div class="commenttext">
<span class="comment_date">COMMENT-POST-DATE</span>
<p>COMMENT-TEXT</p>
</div> <!-- END COMMENTTEXT -->
<div class="modcolumn">
<a href=""><img class="delete " src="../../images/icons/error.gif"></a>
Delete
</div>
</li>
<!-- END comment block-->
</ol>
Another question, the list cells alternate background color in my script, so how could I make it insert class="thread-even" or class="thread-odd" depending on the last item?