Kaishu Kaishu - 1 year ago 75
jQuery Question

How to create new array element and add at end of array using jquery?

I have an Array of objects and need to add new object as per some criteria. As consist list of objects as:

enter image description here

How to create new object which have all above properties and add to end of array using jquery?

Answer Source

You can use the push() method of the array to do this:

// assuming 'arr' is the variable containing the array you showed in the question:
    AgentOnlyFieldFlag: 'False',
    // other properties here...

More info on push()

Also note that you should really change the AgentOnlyFieldFlag, BlankCaptionFlag and PromatchFlag to contain boolean values instead of strings.