Answer the question
In order to leave comments, you need to log in
How to send texrarea content with ajax?
Editor initialization:
ClassicEditor.create( document.querySelector('#add-page-content') )
.then( editor => {console.log( editor );} )
.catch( error => {console.error( error );} );
var pageContent = $("#add-page-content").text();
$.post(url,'&method=pageСreate&pageName=1&pageContent='+pageContent,function(data) {
data = JSON.parse(data);
if (data['status'] == 1){
alert('Страница успешно создана!');
}else{
alert('Произошла ошибка');
}
});
if( $data['method']=='pageСreate' ){
$pageContent = $data['pageContent'];
$savePage = file_put_contents("1.html", $pageContent);
if( $savePage ){
echo json_encode(array('status' => '1'));exit();
}else{echo json_encode(array('status' => '0'));exit();}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question