We help IT Professionals succeed at work.

Dynamically load contents of a form textarea using JQuery

garethtnash asked

I have a page that lists multiple records. I want users to be able to click an edit link next to any record and be able to edit the record in a form that appears on the page without a page refresh. currently i am displaying the form using query to change the display setting, but i need to be able to populate the form with the data for that particular record.

I'm using classic ASP to create recordset which i then turn into an array to display the records.

Any suggestions on how to do this?

Thank you
Watch Question


Hello All,

Just to add a little extra information here, so far what i have is this;

<a href="#" class="editlinks" data-id="12">Edit</a><

Open in new window

and my JQuery is;

        $("#AddProfile a.editlinks").click(function () {


Open in new window

So in principle, this should show the form #Edit_Personal_Statement with a texture with a value of 12.

The value isn't showing.

Any suggestions?

Thank you


Quick update; the above works on a standard textarea, but i'm using tinymce and nothing is displayed...
Developer & EE Moderator
Fellow 2018
Most Valuable Expert 2013
To the main part of your question, you want to submit data without a page refresh and have the new data appear on the page.

To do that you will use jquery ajax http://api.jquery.com/jquery.ajax/ and the returned data gets injected to where you need on the page.  To start, create a new blank asp page that accepts form input just as if you were going to submit a form to it.  

  method: "POST",
  url: "myapi/getHistory.asp",
  data: { name: "John", location: "Boston" }
  .done(function( data ) {
    //alert( "Data Saved: " + data );
  // assume for now you want the returned data to show up on a div#results

Open in new window

If you are getting multiple results, I would probably either a) format the returned data on my asp page such as a table, then do as I show above or b) format the data from the asp page as either json or delimited with an odd character such as a pipe "|".   Then convert the delimited response in jquery and place the appropriate pieces of data in a form field or other area.

For you tinymce, if it has an id (and make sure it is unique) you should be able to do $("#TinyMCE_textarea").html("<h2>Heading</h2><p>some stuff</p>");

Also, check your browser console for errors.  An error in one place my prevent something else from working.


Thanks Scott