Im developing a custom component for Joomla 3.0 and i'm using a editor field in one of my views. I'm developing my views out of pure HTML and JS not out of Joomla XML Structure. I have successfully been able to load and use the editor field, but when i'm posting the form data to my controller using ajax, the editor field is not showing, or is null.
How can i post the content of the editor to my controller using ajax ?
Form Code -
<form id="servicecategory-form" name="servicecategory-form" enctype="multipart/form-data">
...
<!-- description editor-->
<div class="control-group">
<label class="control-label">
<a href="#" data-toggle="tooltip" title="Description">
Description
</a>
</label>
<div class="controls">
<?php
$editor = JFactory::getEditor();
echo $editor->display('description', '', '270', '300', '50', '10',false);
?>
<p class="help-block"></p>
</div>
</div>
...
</form>
Javascript Code -
function saveServiceCategory() {
var form = jsn('#servicecategory-form');
var formData = form.serialize();
jsn.ajax({
type: 'POST',
url: 'index.php?option=com_centrilliontech_helloworld&task=custom.saveData&tmpl=component&format=raw',
cache: false,
data: formData,
beforeSend: function() {
jsn('#loading-modal').modal('show');
console.log('beforeSend');
}
})
.success(function(response) {
var value = jQuery.parseJSON(response);
if (value.error) {
alertBar('alert-error', 'Service Category', 'Error');
} else {
alertBar('alert-info', 'Service Category', value.message);
}
})
.complete(function() {
jsn('#loading-modal').modal('hide');
console.log('complete');
})
.error(function() {
alertBar('alert-danger', 'Service Category', 'Oops! An error occurred. Please try again later.');
});
}
Please assume that the ajax request and anything to do with the posting of data to the associated controller is working fine, which it is, the only issue is here is how can i access the content of the editor and post it to the controller so i can save it in the database.
Thanks for your help in advance.