Appreciate your help in the following:
we need to allow user to POST new topics client-side with some tags that include “&” (like UTF-8 symbol characters, starting with “&#” and some other)
we use client-side calls like that (prefix is like “title=New topic title&category=uncategorized&raw=”)
$.ajax({
url: "http://community.yoch.tv/posts/",
type: 'POST',
dataType: 'json',
//contentType: 'application/json', //that brings 400 mistake, doesnt look that DS accepts THAT contentType
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
processData: false,
data: { title: "New Topic Title with json data to check", category: "uncategorized", raw: "It might work with json POST. But it's not." },
//that brings "Failed to load resource: the server responded with a status of 422 (Unprocessable Entity)
success: function (data) {
console.log(JSON.stringify(data));
},
error: function(){
console.log(JSON.stringify(data));
console.log("Cannot get data");
}
});
Yes, this JS runs on the same DS under admin user. It works with string data (looks like contentType: ‘application/json’ is not supported) and creates new topics but cut at “&” in raw (which is understandable with urlencoded POST). that we would like to overcome.
Robin suggested json workaround, but again, it looks like contentType: ‘application/json’ is not supported for POST.