Saqib Abbas

Saqib Abbas

  • 1.9k
  • 6
  • 1.7k

Return only changed fields.

Jan 27 2015 5:23 AM
Hi there!

I am dynamically creating views using JQuery which consists of a tables that has editable fields i.e every td contains an input of type text. As soon as the user makes changes to any field I want the entire row corresponding to the field to be pushed into an array and then that array be passed to a http-post  action method where the changes can be made to data base using This is what i tried which does not work as the array passed on the action method is always empty can anyone tell me what is wrong with it? Thanks in advance.
 //This function gets invoked on button click     
 function getAllChanges() {
 //Declared earlier
 arr1 = new Array();
 $.each("#tblSubDepts tbody tr input[type='text']".change(function () {
//push parent, that is the 'tr' into arr1
 return arr1;

data attribute of ajax call that i am using
data: JSON.stringify({obj:(getAllChanges())}) 

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (2)