Menu
Hello. Here is javascript object convert to url params issue.
“`
var urlParams = {
timezone : ‘EET’,
indicators: [‘black sea’, ‘red roses’]
};
When run in console with jquery:
` console.log($.param(urlParams, true));
Result is wrong:
`timezone=EET&indicators=black%20sea&indicators=red%20roses&indicators=john
Problem is that param “indicators” repeated.
How to display the parameter only once and separate the array (indicators) elements with a comma?
Comma is %2C
Like this:
`timezone=EET&indicators=black%20sea%2Cred%20roses%2Cjohn
Thank you.