faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

25 of 57 people (44%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Is there a straightforward (no tricks) Javascript only solution to read from a url (i.e. http://xxx.com/yyy.php) and put its contents in an object?

Apr 5th, 2008 19:13
ha mo, Colin Fraser, Andy Sy,


This question is somewhat vague, so I will answer the question I see,
and just hope I get it right enough for you to determine an answer...
Yes, try:
var x=window.location
This places the location into an easily referred variable. You then
manipulate the variable into whatever object you need it in. From there,
there is any number of methods you can use to determine such items as
length of the string, searching the string for particular characters,
getting the index numbers of those characters and creating sub-strings
and so on. 
You may want to look at 
length
substring()
ChatAt()
IndexOf()
in Netscape's JavaScript Developer site, there is a link to it  on the
FAQTS JavaScript front page.  
Hope this points you in the direction you want to go.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com