I have a tinymce wysiwyg and i want to post the html from it to my action method:
$("#save").click(function () {
var ed = tinymce.get('wysiwyg');
var id = $("#destinationId").val();
var PostContent = JSON.stringify({ 'content': ed.getContent(), 'destinationId' : id });
console.log(PostContent);
$.ajax({
url: '@Url.Action("SaveDestinationContent", "Home")',
type: 'POST',
dataType: 'JSON',
cache: false,
data: PostContent,
success: function (data) {
},
error: function (xhr, error) {
},
});
I always get null in my action method that looks like this:
[HttpPost]
public ActionResult SaveDestinationContent(string content, string destinationId)
{
return Json("TRUE");
}
i have tried to do this in a couple of different ways:
$("#save").click(function () {
var ed = tinymce.get('wysiwyg');
var PostContent = ed.getContent();
console.log(ed.getContent());
var id = $("#destinationId").val();
$.ajax({
url: '@Url.Action("SaveDestinationContent", "Home")',
type: 'POST',
dataType: 'JSON',
cache: false,
data: {
content: PostContent.toString(), destinationId: id
},
success: function (data) {
},
error: function (xhr, error) {
},
});
but none of them work!
Aucun commentaire:
Enregistrer un commentaire