How to update a table row with save button using .ajax

Posted by Randall on Stack Overflow See other posts from Stack Overflow or by Randall
Published on 2010-06-02T00:32:11Z Indexed on 2010/06/02 0:43 UTC
Read the original article Hit count: 329

Filed under:
|
|
|

I have a table which has one row and only one cell will be editable. I have accomplished this with the following code.

$("td#effEndDate").click(function() {
            if (!$(this).hasClass("edit")) {
                var value = jQuery.trim($(this).html());
                $(this).html("<input id=\"txtEdit\" type=\"text\" value=\"" + value + "\" />");
                $(this).addClass("edit");
                $("#txtEdit").focus();
            }
        });

Now this is the part where i'm stuck.

After the field is updated a save button must be clicked to call the proper .ajax method to update the database. But how can I compare the previous value to the current value on a button press? Since i'm not using the onblur property where I could have saved the old value and passed it to the update function.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about jQuery