So I use the TEXTAREA
tag to send comment text (1500 characters max) but It doesn't work.
When I use just a couple of words to send then it is working fine.
Any clue, guys?
The error
Failed to load resource: the server responded with a status of 400 (Bad Request)
JS
var commentText = $("#commentTextArea").val();
if (commentText.length > 0) {
var urlGetComments = window.location.protocol + '//' + window.location.host + "/Gadget/PostComment/" + userId + "/" + commentText;
$.ajax({
type: "POST",
url: urlGetComments,
data: "",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (dataComments) {
if (dataComments.html != null) {
$('#divCommentsData').html(dataComments.html);
}
}
});
}
C#
[AcceptVerbs("POST")]
[HttpPost]
[ValidateInput(false)]
public JsonResult PostComment(string userId, string commentText)
{
try
{