How to read a file line using php in a javascript variable without the breakline character ?

Posted by coolboycsaba on Stack Overflow See other posts from Stack Overflow or by coolboycsaba
Published on 2010-04-30T13:56:21Z Indexed on 2010/04/30 13:57 UTC
Read the original article Hit count: 218

Filed under:
|
|
|

I have a txt file on the server which contains 10 lines of text. The text file is rewritten sometimes, and I get new lines using "\r\n". My problem shows when I want to load the lines in javascript variables. I do it like this, but this work only for numbers or for the last line of the file, because its not using the breakline tag: var x = '<?php echo $file[0]; ?>'; Ive tried to alert(x) but it`s not working.... (working only if I read the last line) Any idead ?

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript