Technology for the masses. What more could a sentient being want?

Simple Desktop


 
July 27th, 2008 at 11:58 pm

Mootools, tinyMCE, and the get method

Let’s say you’ve got this sweet little Mootools AJAX page with a tinyMCE textfield. You think “wouldn’t it be awesome to have a ’save now’ button just like WordPress or Google Mail”. Great idea! Have you tried?

It’s not as easy as it should be. A straight AJAX get method won’t grab the content so you go to the tinyMCE site and search. What you find might help but you don’t want to integrate with a plug-in button, you just want to trigger a DB save without reloading the page. What next? Google it?

Good luck. Unless search results have improved recently or you found this blog you are probably SOL. But you found the answer right here!

I’m not going to tell you what to do with the content once you’ve got it set to a variable because if you need that kind of help, you shouldn’t be messing with AJAX yet. Learn to work with a dynamic site first. Here you go…

var tmVal = tinyMCE.get(’ideaExpand’); //get the dump from tinyMCE
var saveVal = etmVal.getContent(); // now go do something with saveVal

Obviously, saveVal now has the content you need to write to your DB. Cheers!

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Google
  • Fark
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis
  • YahooMyWeb
Tags: , ,
-

 

RSS feed for comments on this post | TrackBack URI