Javascript can't read local files from the users computer unless you use a form with a file input and HTML5. Even then it is a bit hit and miss as some browser do not support the required functions.
If you want to load a file form the server you can use the XMLHttpRequest object and get the responseText or responseXML, depending on the format of the data.
Once you have the data loaded in either of these ways you can use arrays and string splitting just like you would in PHP, although Javascript is considerably less reliable and fast as PHP.