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 8419705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:41:10+00:00 2026-06-10T02:41:10+00:00

how to update a table without redirecting the page using javascript or jquery this

  • 0

how to update a table without redirecting the page using javascript or jquery
this is my script

    function doubleclick(table,id1)
        {
            table.innerHTML="<input type=text name=tab onBlur=\"javascript:submitNewName(this,'"+id1+"');\" value=\""+table.innerHTML+"\">";
            table.firstChild.focus();

        }
        function submitNewName(text,id2)
        {
            text.parentNode.innerHTML=text.value;
        $.ajax({
            url: 'update',
            data:{text1:text.value,id:id2},
            type:"POST",
            dataType:"json",
            error:function(data)
            {
                alert('error')
            },
            success: function(data) 
            {
               // alert('updated!')
            }
        });  
        }

html

<td onDblclick="javascript:doubleclick(this,${item.id});">${item.filedesc}</td>

when i double click the table a edit box will appear within the column,an onblur event is called when the text box loses focus (by clicking outside the table), when it loses focus a update servlet should be called without redirecting the page. the update process should occur in the background

Edit

sorry for the late edit.did some editing to my script.i have posted my full working html and javascript code.solved this issue a month ago.users please check the code and suggest whether it can be improved more.

  • 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-06-10T02:41:11+00:00Added an answer on June 10, 2026 at 2:41 am

    You can use jquery’s ajax to achieve this. You can pass a callback method so it will notify you when the real update is complete.

    This is a table cell, it can be anything, i am using div for this example:

    <div id="table-cell" editing="0">Value</div>    
    

    js should be something like this

    $('#table-cell').dblclick(function(){
        if ($(this).attr('editing') == '0')
        {
            // only trigger this when the cell is not in edit mode
            $(this).attr('editing',1);
    
            // show the input
            var input = $('<input type="text" value="'+$(this).html()+'">');
            $(this).html('');
            $(this).append(input);
    
            // bind blur event to input
            input.blur(function(){
    
                // update value from input to the table cell
                var value = $(this).val()
                $(this).parent().html(value);
                $(this).parent().attr('editing',0);
    
                // send the data to the server for update
                $.ajax({
                    url: '/save_data/',
                    data: {data:value},
                    type:"POST",
                    dataType:"json",
                    error:function(data){alert('error')},
                    success: function(data) {
                        alert('updated!')
                    }
                });
            });
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

javascript(jquery) $('.ic_parent').change(function(){ var id = $(this).attr('value') while (id.length >0){ if ($(this).attr('checked')) { $('#update_ics_table').find('input:checkbox[id =
Original Question mysql-server-6.0.10 I have this problem, I'm using the COMPRESS function to update
How can we update timestamp in table without any updation without below statement update
What's the syntax for an Update query for a table without a primary key?
I want to accomplish this (mysql) query: UPDATE table SET field = field +
Hi I am having a problem when trying to update a table using an
I'm trying to use form submit with jquery without a page refresh as demonstrated
This is the code I'm using to update an SQL database: Public Sub main()
Oracle SQL Developer allows you to update field values directly to the table without
Is it possible to transpose an html table (without javascript). I m generating a

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.