Skip to content Skip to sidebar Skip to footer

Convert Array To Query String In Meteor

I am trying to get a artist profile from Echonest. I need to have a parameter named 'bucket' multiple times in the query string. I am trying to set it with an array with the object

Solution 1:

I could be misinterpreting your question, but it seems like you are asking how to dynamically build a set of query string parameters. You could have a simple helper like this:

function getParams( arr ) {
    varparams = [];

    for ( i = 0; i < arr.length; ++i ) {
        params.push( 'bucket=' + arr[ i ] );
    }

    returnparams.join( '&' );
}

and pass in your array of param values like this:

var params = getParams( bucket );

http://jsfiddle.net/7vaLcjxs/

Post a Comment for "Convert Array To Query String In Meteor"