Solution 1 :

The server is probably configured to not accept html. You could maybe try to change that setting, or alternatively you could encode the html before the ajax call. Then on the server you would need to decode it.

Problem :

I have some HTML content and need to pass it to the back end via FormData.append. When I try to pass it like HTML contents it shows me Internal Server 500 error. When I pass just text then it successfully hit to the backend.


 var _description = "<p><b>Test Description</b></p>";
 var formData = new FormData();
 formData.append("Description", _description)

Then Send it to the backend via AJAX Call,

            url: $("#addNewsDetails").val(),
           // cache: false,
            type: "POST",
            data: formData,
            dataType: 'json',
            contentType: "application/json; charset=utf-8",
            mimeType: 'multipart/form-data',
            processData: false,
            contentType: false,
            success: function (status) {


Comment posted by Pirate

your code works fine for me without any exception. probably you are processing data that is causing issue. do you have a try-catch block? actual exception would be in catch block. regardless, you have duplicate declaration of “contentType” in ajax call.