Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7502501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:53:47+00:00 2026-05-29T20:53:47+00:00

i’m a newbie to jquery… i just recently discovered the jquery UI library. what

  • 0

i’m a newbie to jquery… i just recently discovered the jquery UI library.
what i have so far is a php web page that contains a table.
each row in the table shows 3 values: an id, a file name, and the contents of the file. thanks to the jquery UI library, i also have an EDIT button that lets the user change the contents of any of the cells. now i would like to somehow automatically save their changes, not just to the cell in the table, but also to the original file.

based on some other posts here on stackoverflow, i think i need to use .$get to call another php page to do the save for me. but i don’t know how to pass the correct data from the table. i would want to pass the file name, which is column 2, and the file contents, column 3. but i don’t know how i would do that.

here’s the jquery code i have so far (based on a sample from the www)

$(document).ready(function() {
    TABLE.formwork('#configs');
});

var TABLE = {};

TABLE.formwork = function(table) {
    var $tables = $(table);

    $tables.each(function() {
        var _table = $(this);
        _table.find('thead tr').append($('<th class="edit">&nbsp;</th>'));
        _table.find('tbody tr').append($('<td class="edit"><input type="button"         value="Edit"/></td>'))
    });

    $tables.find('.edit :button').live('click', function(e) {
        TABLE.editable(this);
        e.preventDefault();
    });
}

TABLE.editable = function(button) {
    var $button = $(button);
    var $row = $button.parents('tbody tr');
    var $cells = $row.children('td').not('.edit');

    if ($row.data('flag')) { // in edit mode, move back to table
        // cell methods
        $cells.each(function() {
            var _cell = $(this);
            _cell.html(_cell.find('input').val());
        })

        $row.data('flag', false);
        $button.val('Edit');
        // i think this is where i need to do something like $.get("savefile.php",  {filename: '', datatosave: ''});
    }
    else { // in table mode, move to edit mode
        // cell methods
        $cells.each(function() {
            var _cell = $(this);
            _cell.data('text', _cell.html()).html('');

            var $input = $('<input type="text" />').val(_cell.data('text')).width(_cell.width() - 16);

            _cell.append($input);
        })

        $row.data('flag', true);
        $button.val('Save');
    }
}​

any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:53:48+00:00Added an answer on May 29, 2026 at 8:53 pm

    Consider the separation of your data and your user interface. The interface (your table) should be a represenation of your data that is stored in variables in your application. When you change the values in the table, you should then update the variables containing that data. When you save, you save the data, not the HTML table.

    Your table is just a container that should be populated from your data. JSON is a good structure yo use to represent and store your data:

    [
      {  id: "1" , file: "something.txt" , content: "Hello", row: "1", col: "1" },
      {  id: "2" , file: "happyfile.txt" , content: "I am so happy", row: "1", col: "2" }
    ]
    

    You then take this JSON data, loop through it and fill-in your table.

    When you Update the table update the associated JSON value. Save the JSON on the server, not the HTML.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm trying to create an if statement in PHP that prevents a single post
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.