Linked Questions

0 votes
1 answer
2k views

I am trying to create a JavaScript object to convert to a json to send via ajax $("#submitList").on("click", function(){ var Book = { book : new Array()}; var sheetsArray = new Array(); ...
jazzjazzy's user avatar
  • 442
0 votes
3 answers
2k views

I am trying to send a javascript object to PHP using JSON.stringify and I cannot find a solution. Here`s an example of what I have: var small_array = [], final_array = []; small_array["ok"] = "...
Iulian's user avatar
  • 25
0 votes
2 answers
94 views

I'm creating a JS object like this var eleDetailsTop = new Array(); var j = 0; var id = "ele"+j; eleDetailsTop[id] = {id: id, size : "40%", sizeLabel : 12, type : "image"...
Tharindu Thisarasinghe's user avatar
-3 votes
1 answer
69 views

I am trying to pass an array through jQuery's ajax. The problem is that when I try to pass the array created in JavaScript to JSON, it returns something empty. I even try console.log, but when I try ...
Tprogramer's user avatar
0 votes
1 answer
36 views

I'm trying to JSON.stringify an associatif array in javascript, when i console.log it the output is : Array[0] adresse: "zfzf" adresse2: "zfz" adresse3: "fzfz" code_postal "fzfz" [...] length: 0 [......
websitediscount websitediscoun's user avatar
0 votes
0 answers
34 views

I use a forEach() loop, inside which I modify a (associative) array declared earlier. But whatever I try, it seems the change only happen inside the if/else, and is ignored outside it. What did I do ...
DrakaSAN's user avatar
  • 7,926
81 votes
7 answers
179k views

I must be missing something here, but the following code (Fiddle) returns an empty string: var test = new Array(); test['a'] = 'test'; test['b'] = 'test b'; var json = JSON.stringify(test); ...
Sherlock's user avatar
  • 7,637
35 votes
2 answers
228k views

So I'm creating an array with element information. I loop through all elements and save the index. For some reason I cannot convert this array to JSON! This is my array loop: var display = Array(); $('...
Christine Wilson's user avatar
13 votes
4 answers
31k views

I have a situation like follows: I have a id select page where user can select id from the shown ids on the page.When the user select the id i store them as a comma seperated value in a hidden input ...
user882196's user avatar
  • 1,721
11 votes
4 answers
29k views

I've been losing hours over something that might be trivial: I've got a list of comma-separated e-mail addresses that I want to convert to a specific JSON format, for use with the Mandrill API (https:...
chocolata's user avatar
  • 3,358
1 vote
3 answers
1k views

I read that array can be as map, so why does it gives wrong result? Is there simple native way to use map in JavaScript and then get the length of it? var f = []; f["1_f_1"] = "1"; f["2_f_2"] = "2"; ...
user63898's user avatar
  • 31.2k
0 votes
2 answers
3k views

I need to parse a table to JSON, I found this solution and it works: var tab=[{"value":"1.0","label":"Alabama"},{"value":"2.0","label":"Alaska"}, {"value":"3.0","label":"American Samoa"}]; ...
Kimo_do's user avatar
  • 1,038
1 vote
3 answers
2k views

I am trying to store an array in localStorage (HTML5) which needs to be a string, but enable direct access to objects I store in the array by defining the index. When I try to JSON.stringify I just ...
Mike S.'s user avatar
  • 4,879
-6 votes
4 answers
5k views

I have an array which is declared like this: array = []; and has values as shown below - .... ChIJOaegwbTHwoARg7zN_9nq5Uc:"ChIJOaegwbTHwoARg7zN_9nq5Uc" ChIJXTwCdefHwoAR9Jr4-le12q4:"...
john's user avatar
  • 45
1 vote
1 answer
2k views

Look I want to do this: function MyObject() { this.attr1; this.attr2; this.attr3; } var myArray = new Array(); myArray["a"] = new MyObject(); myArray["b"] = new MyObject(); myArray["c"] = new ...
CRISHK Corporation's user avatar

15 30 50 per page