0

I'm trying to emulate his:

"someArray" => array:3 [▼
    0 => "3"
    1 => "17"
    2 => "21"
  ]

But I'm getting:

  "myArray" => array:1 [▼
    0 => "3,17,21"
  ]

I'm doing:

var optionsChecked = [];
optionsChecked.push($(this).val());
console.log(optionsChecked);

I need to get what I write first

pmiranda
  • 7,602
  • 14
  • 72
  • 155

1 Answers1

0

You can use the spread operator after split()

optionsChecked.push(...$(this).val().split(','));
Maheer Ali
  • 35,834
  • 5
  • 42
  • 73