How can i refresh a specific part on page?

Metaton

Newbie
Joined
May 22, 2014
Messages
40
Reaction score
12
Soo like if i only want the ads to refresh on my page but if i wrrite it like
<head>
<meta http-equiv="refresh" content="0">
</head>

It refresh the whole webpage... So any idea how to refresh a specific part of the webpage?
Like i make a table with an ad inside of it and its refreshing...
 
I am a software developer and you cannot do it. If you want to refresh only part of a page then you have to enclose that part of the page in an iframe.

Check w3schools iframe on Google :)
 
You need an Ajax call. Look at jQuery it has a method specifically for this purpose.
 
Only with iframe. I will give you an example

The part of the page that you want to reload:
Page: iframe.php
<iframe name="example" src="yourads" width="300" height="250"></iframe>

The Refresh button outside of the iframe:
<a href="iframe.php" target="example">Refresh</a>


 
Last edited:
Or you can use this code inside iframe.php
<input type="button" value="Refresh" onClick="window.location.reload()">
 
Last edited:
You can refresh a specific part of a page with ajax. if you would like me to help show you how. let me know more details am a web developer and am sure you can
 
Here you will need the help of ajax. You can refresh a specific area like an area inside any div with the help of jquery ajax. It's a very powerful thing and very easy to learn too.
 
Create a div like below
<div id="refresh_this">your content</div>
Use ajax call get the required content assgn the same to DIV like below
document.getElementById('refresh_this').innerHTML = your ajax page response

Hope it helps you little bit
 
If it is only a particular section of a web page requiring a refresh from the client side with running a javascript code already on your page then you do not need to use AJAX... AJAX is for sure the answer should the refresh require calls from server to run algo's and/or info pulled from a database... So you could write the code to be in javascript which executes every xx seconds looping around and then calling the code which then displays the ads... Something like this would be a start....

//currently set to execute every one second
var myVar=setInterval(function () {myTimer()}, 1000);

function myTimer() {
var d = new Date();
document.getElementById("demo").innerHTML = d.toLocaleTimeString();
//e.g. call the code here which runs the ad display...
}

Noting that you can call this function within the body tag of your html e.g.

<body onload="myTimer()">

And further the refresh element is enclosed by the correct id tag holding it e.g.

<div id="demo">

<!-- here is where your ads are located--->

</div>
 
Last edited:
This can be done using ajax, same way the email provider refreshes their inbox and other folders.
 
My Reference to you is to use ajax.

The Function should be built fetching the current page due to ajax, but no to the whole page, only the division of question from the server. Then the data will be put inside the same division in question and will be replaced to the new one by th old one.

Good Luck.
 
Hi,
You can refresh a particular page but you cannot refresh a particular part of a page....
 
Back
Top