So I've the following page (edited for brevity):
- <html>
- <head>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
- <script type="text/javascript" src="./js/test.js"></script>
- <title>test</title>
- </head>
- <body>
- <legend>Page to edit</legend>
- <label for="page">Page: </label>
- <select title="Page" name="page" id="page">
- <option value="0">- Select -</option>
- <option value="page1.php">page1.php</option>
- <option value="page2.php">page2.php</option>
- <option value="page3.php">page3.php</option>
- <option value="page4.php">page4.php</option>
- <option value="page5.php">page5.php</option>
- </select>
- <legend>Content</legend>
- <?php
-
- $editor = new CuteEditor();
- $editor->Text = "Please select a page using the drop down list above.";
-
- $editor->ID = "editor1";
-
- $editor->Draw();
- ?>
- </body>
- </html>
with test.js looking like this:
- $(function(){
- var editor1 = document.getElementById('editor1');
- $('#page').change(function(){
- $.ajax({
- url: "getPage.php",
- data: {
- pageName: $(this).val()
- },
- success: function(data){
- $("#editor1").html(data);
- alert(data);
- editor1.setHTML(data);
- var editor2 = document.getElementById('editor1');
- editor2.setHTML(data);
- }
- });
- });
- });
getPage.php basically returns some html data which is stored within a MySQL database. I know that that bit is working as the alert shows the correct content.
What I want to do is get the content returned by the ajax call into the editor where I can allow the user to alter it.
Later I'll work on saving it back to the database ;-)
Cheers,
Dom
p.s. Tried to post this in via Chrome (10.0.648.151) and it failed, most especially on the code highlight pop-up.