How to send textarea who contains html using Jquery $.ajax

93 views Asked by At

I have made changes on my comments for add TinyEditor(WYSIWYG). to send data i use this jquery function

function AddComent(){
    var formulario="#send_coment";
    var url = "comentario.php";
    var destino="#leercomentarios";
    $.ajax({
            type: "POST",
            url: url,
            data: $(formulario).serialize(),
            success: function(data)
                {
                    $(destino).html(data);
                }
        });
    envio_comentario.reset();
    $("#iframe_a_limpiar").contents().find("body").html('');
}

I have tried to set json data datatype, and more option that i have read in other places, but my log say same concept, error 403, it only happens depending the html entities to send, if i use the editor only with one or none style it works.

By other side, i have tried to use tinyeditor on pure PHP HTML, and it works fine.

Anyone know where is the problem on my script.


(thanks to Quentin for all) The problem is apache security mod, but i cant change it, i have seening a solution like this

function awesome() {
        elements = document.forms[0].elements;
        for(var i = 0; i < elements.length; i++) {
            switch(elements[i].name) {
                case "ads":
                case "shortDescription":
                case "template":
                case "questions":
                case "salary":
                case "jobs":
                    str = elements[i].value;
                    elements[i].value = str.replace(/</g,"#@!");
                    break;
            }
        }
        return true;    
    }

How can i convert this code to do with only with textarea and send all form at same time?

0

There are 0 answers