Skip to content Skip to sidebar Skip to footer

Sending A Tricky Array In A Httpclient

I have to integrate data from an array into a webservice call which isn't the most efficient but it is what it is. I have an array of ids (friend facebook ids). I need to send the

Solution 1:

How about creating your params like that:

functioncreateParams(userId, friendIds) {
    var output = "user_id=" + userId;

    for(var i = 0, max = friendIds.length; i < max; i++) {
        output += "&friend_ids[" + i + "]=" + friendIds[i];
    }

    returnoutput;
}

You can find a working fiddle here.

Post a Comment for "Sending A Tricky Array In A Httpclient"