Destramic Posted October 10, 2011 Share Posted October 10, 2011 hey guys im tring to add entries to an array but im doing something wrong here is the code ive tried...if anyone can help please var found_entries = {"users":[]}; found_entries['users'].push("test"); var found_entries = Array(); found_entries.push("users" : "test"); the result im looking for is var array = {"users":[{"value1", "value2"}]}; thank you Link to comment https://forums.phpfreaks.com/topic/248808-jquery-array/ Share on other sites More sharing options...
haku Posted October 11, 2011 Share Posted October 11, 2011 var users = [], array = {}; users.push("value1"); users.push("value2"); array.users = users; You shouldn't use 'array' as a variable name though - Array is a reserved word, and the two are easy to confuse. It makes it easy to make mistakes. Link to comment https://forums.phpfreaks.com/topic/248808-jquery-array/#findComment-1278157 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.