Reputation: 383
here is my input
<textarea id="mytext" class="txtarea" name="in_content" cols="120" rows="15"><?php echo $term;?></textarea>
here is my ajax code that take value of the textarea above
$('#spdf-form').submit(function() {
$.ajax({
type: 'POST',
url: $(this).attr('action'),
data: $(this).serialize(),
success: function(data) {
$('#spdf_results').html(data);
$('#spdf-form').fadeOut('slow');
var textAreaValue = $("#mytext").text();
alert(textAreaValue);
}
})
return false;
});
it's works, and show the value in the alert popup. Now i want to show the result as php code. i want to insert the value into tinymce editor, and the editor will be called like this
<?php the_editor(''); ?>
so i think i should do this
$myvalues = something to get the results from ajax function
and then i call the editor like this
<?php the_editor($myvalues); ?>
but i dont know how to do that, can someone help me please? i tried to get the value directly but it didnt work also.
Upvotes: 0
Views: 281
Reputation: 3016
PHP is server-side. JavaScript/jQuery/AJAX is client-side. You can't run PHP on the same page after it's been sent to the client.
You'll need to use AJAX to request your editor code from the server, then take the editor code and insert it into the page.
Upvotes: 1