简体   繁体   中英

using ajax how can I display the data from a query in ckeditor

Hello this is my code but i can't see my query data in my ckeditor, can you help me

function mostrar(idnoticia){ $.post("../ajax/editor.php?op=mostrar",{idnoticia : idnoticia}, function(data,status) { data=JSON.parse(data); mostrarform(true); var Dto = data.editor;

        CKEDITOR.instances.myeditor.setData(Dto);
        $("#titulo").val(data.titulo);
        $("#descripcion").val(data.descripcion);
        $("#departamento").selectpicker('refresh');
        $("#fecha_hora").val(data.fecha_hora);
        
            $("#idnoticia").val(data.idnoticia);
    })

}

This is the form

 <textarea class="form-control" id="myeditor" name="myeditor"></textarea>
 </form>
<script type="text/javascript">
     
    CKEDITOR.replace( 'myeditor', {
        height: 300,
        filebrowserUploadUrl: " ajaxfile.php?type=file",
        filebrowserImageUploadUrl: "ajaxfile.php?type=image"
    } );
</script>

Try this,

app.get('/profileface', isLoggedIn, function(req, res) {
// mongoose operations are asynchronous, so you need to wait 
PracticeModel.find({}, function(err, data) {
    // note that data is an array of objects, not a single object!
    res.render('profileface.ejs', {
        user : req.user,
        practices: data
    });
});
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM