I am creating a Javasript object:
var obj= new Object();
obj.Message = $(".textarea").val();
and posting this object via JSON stringify:
$.ajax({
type: "POST",
contentType: "application/json",
dataType: "json",
url: 'xx/yy',
data: JSON.stringify(obj),
success: function (html) {
// ...
},
error: function (request, status, error) {
// ...
}
});
I am getting:
SyntaxError: unterminated string literal in console
What should I replace?
EDIT:
This issue is specific to data the user enters in plain text area (not rich text area)
dataType: "json",withdata: JSON.stringify(obj),is wrong ...dataType: "json", data:obj,and you're golden