1 var comment = {}; 2 comment.postId = 2892826;//每篇博客对应一个唯一的标识ID,必须 3 comment.Body = '123';//评论内容,必须 4 comment.ParentCommentID = 0;//默认0,对现有评论进行评论时,为评论ID,必须 5 $.ajax({ 6 url: '/mvc/PostComment/New.aspx', 7 data: JSON.stringify(comment), 8 type: "post", 9 dataType: "json", 10 contentType: "application/json; charset=utf8", 11 success: function (data) { 12 if (data) { 13 if (data.IsSuccess) { 14 alert("成功!") 15 } else { 16 alert(data.Message); 17 } 18 19 } else { 20 var errorMsg = "抱歉!评论提交失败!请与管理员联系(contact@cnblogs.com)。"; 21 alert(errorMsg); 22 } 23 }, 24 error: function (xhr) { 25 alert("抱歉!评论提交失败!错误信息:" + xhr.responseText); 26 } 27 });