Advanced Search

Results 1 to 2 of 2

Thread: jQuery POST tinyeditor

  1. #1
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default jQuery POST tinyeditor

    i have this which works well but want to change it to a jQuery version
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" href="style.css" />
    <script src="http://code.jquery.com/jquery.min.js"></script>
    <script type="text/javascript" src="tinyeditor.js"></script>
    </head>
    <body>
    <form id="bodyText" method="POST" action="confirmText.php">
    	<textarea id="descText" name="input" style="width:400px; height:200px"></textarea>
    	<input class="bodyTextBtn" type="submit" value="confirm text" onclick='my_instance.post()'/>
    </form>
    <script type="text/javascript">
    var my_instance = new TINY.editor.edit('editor',{
    	id:'descText',
    	width:730,
    	height:400,
    	cssclass:'te',
    	controlclass:'tecontrol',
    	rowclass:'teheader',
    	dividerclass:'tedivider',
    	controls:['bold','italic','underline','strikethrough'],
    	footer:true,
    	fonts:['Verdana','Arial','Georgia','Trebuchet MS'],
    	xhtml:true,
    	cssfile:'style.css',
    	bodyid:'editor',
    	footerclass:'tefooter',
    	toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'},
    	resize:{cssclass:'resize'}
    });
    </script>
    </body>
    </html>
    so i would have to change those areas in highlight to
    Code:
    <form id="bodyText" method="POST" action="">
    
    <input class="bodyTextBtn" type="submit" value="confirm text"/>
    and my jQuery code which doesnt work at the moment
    Code:
    $("#bodyText").submit(function() {
    	var $form = $(this),
    	dText = $form.find( 'body[id="editor"]' ).val();
    	$.post( 'confirmText.php?', {descText:dText}, function( data ) {
    		//call back
    	});
    	return false;
    });
    confirmText.php
    Code:
    <?
    $bar =  $_POST['input'];
    ?>

  2. #2
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    getting closer, this is outputting. atleast its something

    [object Object]1

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>TinyEditor - JavaScript WYSIWYG Editor</title>
    <link rel="stylesheet" href="style.css" />
    <script src="http://code.jquery.com/jquery.min.js"></script>
    <script type="text/javascript" src="tinyeditor.js"></script>
    </head>
    <body>
    <form id="bodyText" method="POST">
    	<textarea id="descText" name="descText" style="width:400px; height:200px"></textarea>
    	<input class="bodyTextBtn" type="submit" value="confirm text"/>
    </form>
    <script type="text/javascript">
    
    function h(){
    
    var my_instance = new TINY.editor.edit('editor',{
    	id:'descText',
    	width:730,
    	height:400,
    	cssclass:'te',
    	controlclass:'tecontrol',
    	rowclass:'teheader',
    	dividerclass:'tedivider',
    	controls:['bold','italic','underline','strikethrough'],
    	footer:true,
    	fonts:['Verdana','Arial','Georgia','Trebuchet MS'],
    	xhtml:true,
    	cssfile:'style.css',
    	bodyid:'editor',
    	footerclass:'tefooter',
    	toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'},
    	resize:{cssclass:'resize'}
    });
    
    $(document).ready(function(){
    	$("#bodyText").submit(function() {
    		var m = my_instance + "1";
    		$.post( 'confirmText.php?',{descText:m}, function() {
    			// callback
    		});
    		return false;
    	});
    });
    </script>
    </body>
    </html>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •