plain text retrieval from a webservice

T

temoor

function checkValues (Address) {

var values = "hello";
var urlItem = "http://rpc.geocoder.us/service/csv?address=";
urlItem += Address.value + "\n";


values = open (urlItem.toString ());
values=values.toString();
alert(values);
onLoad();


}


i am trying to get geocodes from geocoder.us which is returning plain
text, i need the values
returned and save them in a string, i tried using values =
open(urlItem.toString) and print values in an alert as you can see but
the alert prints "[object]", can anybody tell me how to get the result
in my string variable.

Basically this is the result i am getting, a window opens with this
text in it :
"38.898748,-77.037684,1600 Pennsylvania Ave NW,Washington,DC,20502"

now i want this result in a variable. Hope somebody can help me out
with this.

Thanks
 
L

Laurent Bugnion

Hi,
function checkValues (Address) {

var values = "hello";
var urlItem = "http://rpc.geocoder.us/service/csv?address=";
urlItem += Address.value + "\n";


values = open (urlItem.toString ());
values=values.toString();
alert(values);
onLoad();


}


i am trying to get geocodes from geocoder.us which is returning plain
text, i need the values
returned and save them in a string, i tried using values =
open(urlItem.toString) and print values in an alert as you can see but
the alert prints "[object]", can anybody tell me how to get the result
in my string variable.

Basically this is the result i am getting, a window opens with this
text in it :
"38.898748,-77.037684,1600 Pennsylvania Ave NW,Washington,DC,20502"

now i want this result in a variable. Hope somebody can help me out
with this.

Thanks

The best object to use for this kind of "invisible" request is
XmlHttpRequest. It allows you to send a request and get the result in a
callback without having to open a new window or refresh the page.

See
http://jibbering.com/2002/4/httprequest.html
http://developer.apple.com/internet/webcontent/xmlhttpreq.html

or generally Google for AJAX (asynchronous JavaScript and XML)

HTH,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top