Marviuz Marviuz - 8 months ago 122
HTML Question

Javascript read a txt file onload

I searched through the net but i only get the ones with

<input type="file">
. I also got what I want but for some reason, it only work when I use netbeans and click the run project button. What i need is something that would work even without running netbeans.

Answer Source
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
        $("body").load("file.txt");
});
</script>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download