javascript - Get text value from .txt file -
i have script gets value .txt file, have done number value works perfectly, when want .txt file, text , not number "nan" error know stands "not number", how change work can value text in .txt file?
my script.
<div class="displaynamecurrent"> display name: <span id="displaynamedisplay"></span> </div> <script type="text/javascript"> var read = new xmlhttprequest(); read.open('get', 'displaynamefile.txt', false); read.send(); var displayname = parseint(read.responsetext) document.getelementbyid("displaynamedisplay").innerhtml = displayname; </script>
if don't want convert text integer, don't run parseint
on it.