Hi All,

I have a application , which onclick of submit takes content in textarea and do some back end stuff and finally opens a .html in a iframe.

My problem is, the .html in iframe should change on each submit button in coresponding to the content in the textarea.... but its not, can anybody a suggest a solution for this?

           function submit() {
                var textAreaContent = $("#content").val();
                   var content = textAreaContent.substr(textAreaContent.indexOf('\n'),textAreaContent.length);
                    type: 'GET',
                    url: 'submit.php?data='+content+'',
                    contentType: 'application/json',
                    dataType: 'json',
                    success: function(response) {
                    error: function(response) {

 document.getElementById("ChromatinModel").src = "http://dna.engr.latech.edu/~kpc009/ICMGB/ICM/chromatin.html";

            <iframe id="ChromatinModel" width="505" height="500" ></iframe>


I think you should put the content data into the 'data' parameter in the ajax call, instead of adding it to the URL, such as:

url: "submit.php",
data: "{'content':'" + content + "'}",

but it gets a bit tricky with the formatting of the value for the data parameter; the value should be a serialized JSON string, and the contents of a textarea can of course include quote characters etc. I sometimes use a stringify function to serialize an array of data to be submitted, and do something like:

var myParams = {param1: value1, param2: value2};
  type: 'GET',
  url: 'submit.php',
  contentType: 'application/json',
  data: stringify(myParams),
  dataType: 'json',

Depending on the version of jQuery or whatever libraries you are using, or versions of browser you are targetting, the stringify function or other JSON serialisation methods may be available already.