Trying to read text from text file using javascript but getting error on method: split -
this code im using in site:
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script src="http://newsxpressmedia.com/files/theme/jquery.newsticker.js"></script> <script> $(function() { var file = "http://newsxpressmedia.com/files/theme/test.txt"; $.get(file, function (txt) { var lines = txt.responsetext.split("\n"); $ul = $('<ul class="newsticker" />'); (var = 0, len = lines.length; < len; i++) { $ul.append('<li>' + lines[i] + '</li>'); } $ul.appendto('body').newsticker({ row_height: 48, max_rows: 2, speed: 6000, direction: 'up', duration: 400, autostart: 1, pauseonhover: 0 }); }); }); </script>
there nothing no text @ , it's not working.
this site:
http://newsxpressmedia.com/
when im browsing site in case chrome , make:
ctrl+shift+j in console open see this:
consider using 'dppx' units instead of 'dpi', in css 'dpi' means dots-per-css-inch, not dots-per-physical-inch, not correspond actual 'dpi' of screen. in media query expression: screen , (-webkit-min-device-pixel-ratio: 2), not all, not all, not all, screen , (min-resolution: 192dpi), screen , (min-resolution: 2dppx) (index):1 uncaught typeerror: cannot call method 'split' of undefined (index):101 event.returnvalue deprecated. please use standard event.preventdefault() instead.
how can fix 'split' error ?
** text scrolling , show in site other scripts/codes work 1 in question not working.
** want use jquery news ticker read line line text file , scroll jquery. 'split' error think make problem wont let work.
edit**
example how text file im reading content format is:
hello line דווח במקור בתאריך: 22.03.14 שעה : 20:11 hello line דווח במקור בתאריך: 22.03.14 שעה : 22:59
each 2 lines block want show each time 2 lines scrolling , there empty line/space between each 2 groups of 2 lines.
i dunno why expect txt
had .responsetext
property representing text, should use
var lines = txt.split("\n");
Comments
Post a Comment