Reputation: 1515
is it possible?
basically i'm a trying to achieve something like this
JSON.stringify("address=",Obj_address,Obj_city,Obj_state,Obj_zip)
after stringify
to become like
address= "Address city state zip"
in a string like fashion. Reason being is I'm trying to pass this string into my google geocoding url api.
I played around and it so far only 1 parameter can be passed.
Help appreciated and thanks
Upvotes: 0
Views: 62
Reputation: 2832
This would be better.
var str = 'address="'+[Obj_address,Obj_city,Obj_state,Obj_zip].join(' ')+'"';
But you probaby don't need the quotes.
var str = 'address='+encodeURIComponent(
[Obj_address,Obj_city,Obj_state,Obj_zip].join(' '));
Or according to the api with a plus separator.
var str = 'address='+encodeURIComponent(
[Obj_address,Obj_city,Obj_state,Obj_zip].join('+'));
Upvotes: 1
Reputation: 23883
You need to try like this one
alert("address=" + JSON.stringify(Obj_address) + " " + JSON.stringify(Obj_city) + " " + JSON.stringify(Obj_state) + " " + JSON.stringify(Obj_zip));
Upvotes: 0