jQuery: changing element value after serialized

If i have my form elements with values in variable data (contains: var data = $(this).serializeArray();)

How can i do change the value of an form element (called recipient), when it's inside data?

So my element with name=recipient have value "mama", how can I change it to "papa" on ajax success


You can iterate through your objects in the array, change the object's value:

for (var item in data)
  if (data[item].name == 'recipient') {
    data[item].value = 'papa';

Need Your Help

Return random order of list items on form submit

javascript jquery ajax jqueryform

I am submitting a search form via ajax and returning the results from another page into a ul element. I am wondering how to return the li elements in a random order. I am using something called jqu...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.