Sebastian
Sebastian

Reputation: 1654

refreshing only a specific part / element of a website

What I'm trying is to receive some data off a website which is being refreshed once a second. I've been thinking about making use of meta tags, but somehow there aren't any on the website.

I've heen thinking about timers and handlers, but then i would have to refresh the whole site, only to receive the updated data, which is located at the top of the html document. That would cause a lot of traffic.

Is there a way to only refresh a part or even only an element of a page? And if so, how? Currently I'm using jsoup to get data from a document.

Upvotes: 3

Views: 952

Answers (2)

JB Nizet
JB Nizet

Reputation: 691745

If the website is not under your responsibility, and hasn't provided any API or URL used to only get the part of the page you're interested into, then you don't have any other choice: the web page must be reloaded completely. That's how the web works.

Upvotes: 2

cronoklee
cronoklee

Reputation: 6712

Look at ajax. It takes a very simple javascript function call to refresh part of a webpage. http://www.w3schools.com/ajax/default.asp

If you just want to do a running calculation you can do it with javascript:

  document.getElementById('mydiv').innerHTML= (1+1)

Upvotes: 2

Related Questions