Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For example if for someone it will be helpful, you can use it.</p> <p>Situation, i need on change dropdown field value, to change the content of cleditor.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { // Define and load CLEditor $("#input").cleditor({ width: 800, height: 300, controls: "bold italic underline subscript superscript | color highlight removeformat | alignleft center alignright justify | table | undo redo | cut copy paste pastetext | print source ", useCSS: false }); // on change dropdown value $('#dropdown').change(function() { // doing AJAX request by GET $.get( // pushing AJAX request to this file 'ajax/change_dimmensions_table.php', // pushing some data, from which to determine, what content I need to get back {'dropdown_value':$('#dropdown').val()}, function(data, textStatus) { // Clearing the content of CLEditor, adding new content to CLEditor $("#input").cleditor({width:800, height:300, updateTextArea:function (){}})[0].clear().execCommand("inserthtml", data, null, null); }, 'html' ); }); }); &lt;/script&gt; </code></pre> <p>change_dimmensions_table.php:</p> <pre><code>&lt;?php header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past if ( ! empty( $_GET['dropdown_value'])) { mysql_connect('localhost', 'username', 'password'); mysql_select_db('database'); mysql_query("SET names utf8"); $sql = " SELECT `html_content` FROM `templates` WHERE `dropdown` = '{$_GET['dropdown_value']}' LIMIT 1 "; $result = mysql_query( $sql) or die( mysql_error() . " SQL: {$sql}"); if ( mysql_num_rows($result) &gt; 0) { while ( $row = mysql_fetch_object( $result)) { $html = $row-&gt;html_content; } } if ( ! empty( $html)) { echo $html; } } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload