How to display data from a file on website load? [closed]


Tags: html,css,file,web

Problem :

So I have a file that's already constantly being update on my server, but the directory currently isn't in my wwwroot folder until I can actually meddle around in there to get the directory to change.

So question #1 is if it's possible for my site to actually access this file away from the wwwroot? If not, it's okay. I'll find some way to get it in there.

This is however the more important part of this question. The file in question is currently in .data extension and contains a field such as {"cpu":30,"ram":300000}. It's been updated in real time with an application in the background, but how would I get my web page to pull those data and display it? I only started learning HTML and CSS several days ago, so my knowledge is still pretty limited here.



Solution :

I cannot understand your first question. :S Please, could you be more clear?

For the second one, to read the text file you need a javascript code. You can do that as follow:

1º Open the file: file = fopen(getScriptPath("myFile.txt"), 0);
2º Get the content of the file in a string: file_length = flength(file); content = fread(file, file_length);
3º Finally, you can get the part of the string you want by a regex.


    CSS Howto..

    How to deal with my sharepoint datetime control css?

    How to make gridview in asp.net scrollable?

    How to arrange two html buttons horizontally in a single line with equal width by completely fills the screen size

    How do I float a div to the right of a title div without affecting the content of the title?

    Getting an error message to show up inline of input

    simplecart.js Images not Showing in IE8 on blogger.com site

    How to filter elements on click in js?

    How can I create HTML/CSS responsive tile?

    How to build dynamic css main/sub menu's (or do I need jquery)?

    How to reference css and script files into a node.js app?

    how to center css class images with text?

    How to change class named active into link's active attribute in javascript

    How to stick to bottom on layout by using CSS?

    How to emulate window title bar in CSS/HTML

    Heroku Not Showing SCSS Background Images

    CSS: How to move text link to the right inside li

    How to include SASS files and CSS files into version repository and developement cycle

    How can I center my text on top of an image, given that it's responsive?

    How to remove mystery indents in a form?

    CSS: how to make a horizontal images scroller with two images per column?

    How to change element CSS class when different part of web page is present?

    How to change the height of div with the content of other div

    Horizontal Navigation with Angled Side Borders - How to handle “Active” state?

    How to stretch the form submit button using CSS?

    How could I add a header to a HTML page via CSS?

    How to structure css using BEM methodology for adaptive web pages?

    How to make HTML pages print at a consistent size from Chrome?

    How to add css to form elements if attribute class is already being used in Jquery

    How to strech vertically the container of inline-blocks?

    why image show space and go right, it should be fill up the gap