I have the following array of data:
[
{ "id": "1001" },
{ "id": "1002" },
{ "id": "1003" }
]
I need to convert it into a single string with url parameters like this:
https://url.com/data?id=1001&id=1002&id=1003
I have the following array of data:
[
{ "id": "1001" },
{ "id": "1002" },
{ "id": "1003" }
]
I need to convert it into a single string with url parameters like this:
https://url.com/data?id=1001&id=1002&id=1003
var id_list = [
{ "id": "1001" },
{ "id": "1002" },
{ "id": "1003" }
];
var url_param = '';
for(var index in id_list ){
if( url_param != '' ) url_param += '&';
url_param += 'id=' + id_list[index].id;
}
url_param = 'https://url.com/data?' + url_param;
I am sure that this will be helpful for you. :)