Hey I don't know why $(this) not working in my ajax code.I want to append response in #feedback element.
here is my html structure image
AJAX
$("form#userComment").on("submit",function(e){
e.preventDefault();
$.ajax({
url : "request/postComment.php",
type : "POST",
data : new FormData(this),
dataType : "text",
contentType : false,
processData : false,
beforeSend : function(http){
$("#upload").val("Posting..");
$("#comment").val("");
},
success : function(response,status,http){
var text = response.split(" ");
$("#upload").val("Post");
if(text[3] === "'error'"){
$(".response").html(response);
$(".response").slideDown();
}else{
$(this).prev().append(response);
}
},
error : function(http,status,error){
$("#comment").val("Post");
$('.response').html("<span class='error'>Something went wrong</span>");
$(".response").slideDown();
}
})
})