/** Author InkThemes ***/
jQuery('document').ready(function($){
var commentform=$('#commentform'); // find the comment form
commentform.prepend('
'); // add info panel before the form to provide feedback or errors
var statusdiv=$('#comment-status'); // define the info panel
var list ;
$('a.comment-reply-link').click(function(){
list = $(this).parent().parent().parent().attr('id');
});
commentform.submit(function(){
//serialize and store form data in a variable
var formdata=commentform.serialize();
//Add a status message
statusdiv.html('
Processing...
');
//Extract action URL from commentform
var formurl=commentform.attr('action');
//Post Form with data
$.ajax({
type: 'post',
url: formurl,
data: formdata,
error: function(XMLHttpRequest, textStatus, errorThrown)
{
statusdiv.html('
You might have left one of the fields blank, or be posting too quickly
');
},
success: function(data, textStatus){
if(data == "success" || textStatus == "success"){
statusdiv.html('
Thanks for your comment. We appreciate your response.
');
//alert(data);
if($("#commentsbox").has("ol.commentlist").length > 0){
if(list != null){
$('div.rounded').prepend(data);
}
else{
$('ol.commentlist').append(data);
}
}
else{
$("#commentsbox").find('div.post-info').prepend('
');
$('ol.commentlist').html(data);
}
}else{
statusdiv.html('
Please wait a while before posting your next comment
');
commentform.find('textarea[name=comment]').val('');
}
}
});
return false;
});
}); wordpress ajax yorum sorunu
2
●25
- 02-12-2020, 10:51:19aşağıdaki kod ile wordpress sitemde yorum yapıldığında sayfa yenilenmeden yapılan yapımı yorumlar bölümüde ekletiyorum fakat eklenen yorum yorumlar bölümünün en altına gidiyor sayfayı yenileyince en yukarda görülüyor wordpress ayarlarda yorum listelemesi en yeni şeklinde ayarlı ara bu kod yapılan yorumu ol.commentlist içerisinde en alta gönderiyor bu nu en yukar göndermesi şeklinde nasıl ayarlanır
teşekkürler