
Untitled
By: a guest on
Aug 10th, 2012 | syntax:
None | size: 0.78 KB | hits: 8 | expires: Never
jQuery prepending and fading in content does not work
$(".post-submit").click(function(){
var postcontent = $(".post-form").val();
if (postcontent == ""){
return false;
}
$(".post-form").attr("disabled", "disabled");
$.ajax({
url: "/post",
type: "POST",
dataType: "json",
data: {"post-form":postcontent},
success: function(response, textStatus, jqXHR) {
var htmlpost = '<div class="post"> <b>${name}</b> </div> n <p>' + postcontent + '</p> n';
$(htmlpost).hide().prependTo(".posts-content").fadeIn("slow");
},
error: function(jqXHR, textStatus, errorThrown){
alert("Unexpected internal server error. Please try again later.");
}
});
});