Got this working fine on testing server, but on live site, the CKEDITOR.instance isn’t updated, so the session value always seems to be that the text set previously.
On clicking the preview button, a block of js is fired, which does 2 things..
1. it calls an ajax function to set session variables based on the form fields
2. it opens a popup window, which displays the session values in an email ‘preview’
Here is the code
<script type="text/javascript">
$(document).ready(function () {
$('#preview').click(function(e){
$.ajax({
type: 'POST',
url: '/admin/mail/plugins/setmailsession.php',//use full path !
data: {
subject: $('#emailsubject').val(),
eventid: '', //set eventid session value to empty string
message: CKEDITOR.instances['Message'].getData(),
}
})
//alert(CKEDITOR.instances['Message'].getData());
$.window({
title: document.getElementById('emailsubject').value,
url: "/admin/mail/email_campaign_template.php?CampaignType=3",//General Email
width: 650, // window width
height: 650, // window height
draggable: false,
resizable: false,
maximizable: false,
minimizable: false,
showModal: true
});
e.preventDefault();
});
});
</script>
The ‘subject’ session value is updated ok, but the message shows the ‘previous’ content of the editor