Page 1 of 1

JavaScript, reading from a file and opening links.

Posted: Thu May 03, 2007 1:36 pm
by Lethality
I have a logfile on the server and I want to be able to open it with a javascript, go through all the links and open them in separate tabs in the browser. Is this possible?

The links are stored as an array like this (php stored):

Code: Select all

Array
(
    [0] => http://www.randomsite.domain
    [1] => www.randomsite.domain
    [2] => http://randomsite.domain
)

Posted: Thu May 03, 2007 5:32 pm
by Kieran Huggins
on the server? Then you'll want to make an ajax call and parse the file yourself (though you'll need to print the array as text, hint: JSON)

Posted: Fri May 04, 2007 6:09 am
by Lethality
Kieran Huggins wrote:on the server? Then you'll want to make an ajax call and parse the file yourself (though you'll need to print the array as text, hint: JSON)
Any suggestions on how to do that? (I'm pretty new to coding)

Posted: Fri May 04, 2007 2:19 pm
by Kieran Huggins
hmmm... sounds like a job for (a few) tutorials!

Check out jQuery's ajax methods and the php man page for json_encode() - that should get you well on your way.