JavaScript Get content from TinyMCE editor get content from tinymce,get content from tinymce jquery,get

I'm trying to get the Content from TinyMCE, but it only returns null. The problem it's loaded in a Dialog box. The dialog view:

<form>
  <textarea name="content" cols="40" rows="25" id="tinymce"> 
    Dette er noget tekst
        </textarea>
</form>

<input class="close" onclick="get_editor_content()" name="submit" type="submit" value="Kontakt Oline" style="float: right" id="contenttiny" />
<script type="text/javascript">
  tinyMCE.init({
    // General options
    mode: "textareas",
    theme: "advanced",
    plugins: "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
</script>

The view where the dialog is opened from:

<a class="openDialog" data-dialog-id="emailDialog" data-dialog-title="Kontakt/prospekt" target='_blank' href="/Home/tinymce">Contact US</a>

<div id="result"></div>

<script type="text/javascript">
  $.ajaxSetup({ cache: false });
  $(document).ready(function () {

    $(".openDialog").live("click", function (e) {
      e.preventDefault();
      $("<div ></div>")
        .addClass("dialog")
        .attr("id", $(this).attr("data-dialog-id"))
        .appendTo("body")
        .dialog({
          title: $(this).attr("data-dialog-title"),
          close: function () { $(this).remove() },
          modal: true,
          position: ['center', 40],
          minWidth: 670,
          resizable: false
        })
        .load(this.href);
    });
  });


  $(".close").live("click", function (e) {
    e.preventDefault();

    var content = tinyMCE.get('tinymce').getContent(); //$("#contenttiny").val();
    $.ajax({
      type: "POST",
      url: "/Home/tinymce",

      data: { "content": content },

      success: function (data) {

        $("#result").html(data.nameret);
        $(".dialog").dialog("close");
      },

      error: function (data) {
        alert("There was error processing this");
        $(this).closest(".dialog").dialog("close");
      }
    });

  });
</script>

The Controller:

[HttpPost]
public ActionResult tinymce(string content)
 {    /*Your other processing logic will go here*/
  return Json(new
  {
    nameret = content
  }, JsonRequestBehavior.


  AllowGet);
}

P.S. I have used this example to create the modal dialog. Which is an PartialView. It's possible to get the content from tinymce in the main index view. But not in the ajax call.

Answer:1

I've been following this tutorial (http://creativejs.com/tutorials/three-js-part-1-make-a-star-field/) and everything is going fine, but I'd like to know how I can modify the script so then there's ...

I've been following this tutorial (http://creativejs.com/tutorials/three-js-part-1-make-a-star-field/) and everything is going fine, but I'd like to know how I can modify the script so then there's ...

  1. three charged particles form a triangle

I am using Javascript to pass form variables to the PHP page sprcial_action.php but it is not redirecting to that page. My code is given below, please tell me where is the problem? <script> ...

I am using Javascript to pass form variables to the PHP page sprcial_action.php but it is not redirecting to that page. My code is given below, please tell me where is the problem? <script> ...

  1. javascript form variable passing

I want to get the password from the user by means of a prompt box and if the entered password is invalid show an error message in a label which is inside the promptbox I mentioned.I s it possible or ...

I want to get the password from the user by means of a prompt box and if the entered password is invalid show an error message in a label which is inside the promptbox I mentioned.I s it possible or ...

Will the following log itself upon getting clicked in every browser? <a href="#" onclick="console.log(this);">Click me!</a>

Will the following log itself upon getting clicked in every browser? <a href="#" onclick="console.log(this);">Click me!</a>

  1. does reliably mean