Uncaught TypeError: json.comunicado.ASUNTO.html is not a function

0

I'm having a very strange problem and I do not understand it, yesterday it worked fine, and now the entire website is bursting with the same error, I specify a little more:

This is the error:

backoffice.js:37 Uncaught TypeError: json.comunicado.ASUNTO.html is not a function
at Object.success (backoffice.js:37)
at j (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at x (jquery.min.js:4)
at XMLHttpRequest.b (jquery.min.js:4)

I attached backoffice.js:37 :

            boxhtml+="<div id='form-main'>";
            boxhtml+="<p class='asunto'>";
            boxhtml+="<input name='asunto' type='text' class='feedback-input' placeholder='Asunto' id='asunto' value='"+json.comunicado.ASUNTO.html().replace("'","'")+"' />";
            boxhtml+="</p>";
            boxhtml+="<p class='text'>";

Exactly the error marks me here:

"value='"+json.comunicado.ASUNTO.html().replace("'","'")+"' />";

I'll give you the complete code if you want to delve more deeply into the error:

function modificarComunicado(id){
     $.get("modules/backoffice/comunicaciones/leer_comunicacion.php?idcomunicacion=" + id, function(data){
        if(data)
        {
            console.log(data);
            json = JSON.parse(data);
            url="functions/recogidadatos.php";
              urlReturn="modules/backoffice/comunicaciones/gestion_comunicaciones.php";
            var imagen=json.comunicado.IMAGEN;
            var longitud = imagen.length;

            var boxhtml ="";


            boxhtml+="<form action=''name='comunicationUpdate' onload='cargaeditor();' id='comunicationUpdate' method='post'";
            boxhtml+="<div id='box-modificar-comunicado' class='capa-fondo-caja capa-fondo-caja-backoffice centered-absolute'>";
            boxhtml+="<div class='header-caja-fondo-backoffice'>";

            boxhtml+="<h2><span class='icon-document-edit size-icons-table-backoffice'></span>Modificación comunicado</h2>";
            boxhtml+="</div>";

            boxhtml+="<div id='form-main'>";
            boxhtml+="<p class='asunto'>";
            boxhtml+="<input name='asunto' type='text' class='feedback-input' placeholder='Asunto' id='asunto' value='"+json.comunicado.ASUNTO.html().replace("'","'")+"' />";
            boxhtml+="</p>";

            boxhtml+="<p class='text'>";
            boxhtml+="<textarea name='comunicacion' class='feedback-input' id='comunicacion' placeholder='comunicacion'>"+json.comunicado.CUERPO.html().replace("'","'")+"</textarea>";
            boxhtml+="</p>";


            boxhtml+="<input name='id' type='hidden' class='feedback-input' placeholder='id' id='id' value='"+id+"' />";

            boxhtml+="<input name='idNotificacion' type='hidden' class='feedback-input' placeholder='idNotificacion' id='idNotificacion' value='"+json.comunicado.IDNOT+"' />";

            boxhtml+="<div id='contenedor'>";
            boxhtml+="<div class='fecha'>";
            boxhtml+="Fecha Inicio:<input name='fecha_ini' type='date' class='feedback-input fecha' id='fecha' value='"+json.comunicado.FECHA_INI+"' />";
            boxhtml+="</div>";

            boxhtml+="<div class='fecha'>";
            boxhtml+="Fecha Fin:<input name='fecha_fin' type='date' class='feedback-input fecha' id='fecha' value='"+json.comunicado.FECHA_FIN+"' />";
            boxhtml+="</div>";

            boxhtml+="<div class='department'>";
            boxhtml+= "Departamento:<input type='text' name='areadep' value='"+json.comunicado.CREADOR+"' id='areadep' readonly/>";
            boxhtml+="</div>";
            boxhtml+="</div>";

            boxhtml+="<p class='text'>";
            boxhtml+="<input type='file' name='archivo' value='imagen' id='imagen'/> Imagen insertada anteriormente: "+imagen.substring(57,longitud);
            boxhtml+="</p>";

            boxhtml+="<div id='button-blue' onclick='ejecutarJQueryComunicado(url,urlReturn)' class='submit'>";
            boxhtml+="MODIFICAR";
            boxhtml+="</div>";
            boxhtml+="</div>";
            boxhtml+="</div>";
            boxhtml+="</form>";

            añadirCapaFondo(boxhtml);


           $("#comunicationUpdate").ready(function(){
              tinymce.remove();
              tinymce.init({ selector:'textarea' ,
                plugins:"advlist"
            });
           });

        }
    });
}

If you have any idea why this error is leaking, please tell me

    
asked by PictorGames 30.12.2016 в 10:01
source

1 answer

2

The problem you have is that you are handling an object and you are using it as a function. I think that you put only json.comunicado.ASUNTO instead of json.comunicado.ASUNTO.html() should work without problems (and in which you have under BODY too).

    
answered by 30.12.2016 / 13:01
source