Asp.Net Core – Pass Ckeditor textarea value to controller with Ajax?

I am using the ckeditor version 4 plugin … I want to send ckeditot values ​​to the controller but whatever I do sends a null value!! I did a lot of searching, tried all the methods on the site, but it didn’t work:( I downloaded the plugin again from the site but it still failed?

Notice: When I use “Id” instead of “asp-for”, the value is sent, but I need asp-for….

Html Form :

@model Baya.Core.ViewModels.AddProductViewModel
<form id="ProductForm" method="post" enctype="multipart/form-data">
<div class="form-group">
    <label class="control-label">desc</label>
    <textarea  asp-for="Description" class="form-control"></textarea>
<div class="modal-footer">
    <button type="button" onclick="return ValidateForm()" class="btn btn-info waves-effect">save</button>
    <button type="button" class="btn btn-danger waves-effect"

JavaScript Code:

$(function () {
   /* $('#Description').ckeditor();*/
function ValidateForm() {       
    let Form = $("#ProductForm")[0];
    let Form_Data = new FormData(Form);
    var descProduct = CKEDITOR.instances.Description.getData();       
    Form_Data.append("Description", descProduct);
        url: '/AdminPanel/Product/AddAndUpdateProduct',
        data: Form_Data,
        contentType: false,
        processData: false,
        type: 'POST',
        success: function (data) {     

Controller :

    public IActionResult AddAndUpdateProduct(AddProductViewModel model)
    //some code

This image is also output with breakpoint.. enter image description here


I Used This Code:

var descProduct = document.getElementById('Description').value;

Instead of this code:

var descProduct = CKEDITOR.instances.Description.getData();

It’s worked

Source: stackoverflow
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .