1

So I made a HTML page that reads JSON-formatted text file from the server and parse it to use with Google Maps API. (draw some lines on the map, coordinate data recorded in JSON-formatted text)

Now, I'm really new to Node.js, but I heard that it's possible to do async processing with it.

My aim is:

  • There will be post request with JSON-formatted data to the server,
  • The server reads the data and parse it
  • And shows the webpage in real time.

Which means, for every new post request (data send), the page will be refreshed to draw a new lines based on the most recent post request with data.

Now from where I should start with to achieve my goal?

What I tried up to now was, made a server with Node.js that can receive post request and insert the data of post request to the html I made(mentioned at the beginning)

I noticed that if I send any post request, it gives the whole html string as alert(which was intended for knowing what's going on), and the alert string contained that post data. But of course, the page doesn't refresh automatically AND reloading the webpage would reset the post data.

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
TechNew
  • 49
  • 1
  • 6
  • http://stackoverflow.com/questions/1972242/auto-reload-of-files-in-node-js – Sulthan Allaudeen Jul 24 '14 at 05:36
  • @SulthanAllaudeen Actually I believe this user is asking how a user's webpage can be updated in real-time to accompany new data, which I recommend you take a look at Meteor (http://www.meteor.com) for. The question you point to is asking how to refresh the Node server via a save hook, so you don't need to stop and restart it every time you save. – MCKapur Jul 24 '14 at 05:39
  • 1
    Perhaps socket.io is what you need (http://socket.io/) - it allows you to "push" data from the server to connected clients via web sockets – Stephen Byrne Jul 24 '14 at 11:15
  • 2
    @chriz: please don't use inline code spans (`like this`) for emphasis, they should only be used for code within sentences. For more information, see [this Meta post](http://meta.stackexchange.com/a/135113/220428). Also, try to fix obvious issues such as capitalisation and spelling while editing a post. Thanks! – Qantas 94 Heavy Aug 18 '14 at 06:29

0 Answers0