Link to home
Start Free TrialLog in
Avatar of Pete Winter
Pete WinterFlag for United Kingdom of Great Britain and Northern Ireland

asked on

TinyMCE load in jQuery Post

I want to load TinyMCE ( https://www.tinymce.com/download/ ) to a textarea field within my Jquery post code below...

HTML

<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<script>

tinyMCE.init({
        mode : "textareas",
        theme : "advanced"
});

</script>

<div id="Column1" class="ListResults"></div>

Open in new window



Query code...

		$.post( "bespoke_page_script.php", {
									cust_id: $('#customer_id').find(":selected").val()
        						}, function(data) { 
			
		$( ".ListResults" ).html( data );
		tinymce.EditorManager.execCommand('mceAddEditor', false, "message_to_customer");	
							
		});

Open in new window


Code in bespoke_page_script.php ...

<p>
<label for="message_to_customer">Message to Customer</label>
<textarea name="message_to_customer" id="message_to_customer" cols="45" rows="10">
Dear xxxx
</textarea>
</p>

Open in new window


It's not work for me. What am I doing wrong. Can you please send me revised working code please.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pete Winter

ASKER

Yes it works with out the post function.
Sorry. You were right! Just realised my mistake. Many thanks
Great!  Sometimes it's all about asking the right questions :-)