Get content from div for form input laravel
I have a form in laravel (not using blade) using CKEditor. I am trying to get content from it in div
called editorcontents
when I submit the form as it is submitting a blog post (so it should have formatting from that div as well).
I tried to assign name
to a div, but no luck. How do I use a field div
as a field input
?
<div id="editorcontents" name="editorcontents">
</div>
$content = Input::get('editorcontents');
return $content;
+3
source to share
1 answer
Try with ajax in jQuery to get the html content of editorcontents and send it to the controller on the server :) ... I hope this help
Html
<div id="editorcontents" name="editorcontents">
</div>
Jquery
var inputValue = $("#editorcontents").html;
$.ajax( {
type : "POST",
cache : false,
async : true,
global : false,
url : "URL POST DATA",
data : {
editorcontents : escape(inputValue),
}
} ).done( function ( data )
{
//Handle event send done;
} )
+1
source to share