don't worry your problem is easy to solve
, but let me please understand your required scenario, do you want the div content to refresh itself automatically? or just when user click on the link or both?
anyway, this is a simple example where content will be refreshed only when user hits refresh link
HTML Code:
<script type="text/javascript">
$(document).ready(function(){
$(".refresh").click(function(){
$.get("ajax.php", function(result){
$("#div").html(result).fadeIn('slow');
});
});
});
</script>
<div id="div"></div>
<a href="" onclick="return false;" class="refresh">refresh</a>
and this is another example where content will refresh automatically every 10 seconds using timeout with timerID and will refresh when user hits refresh too
note: when user hits refresh the timer would reset and wait new 10 seconds
HTML Code:
<script type="text/javascript">
$(document).ready(function(){
var autoRefresh = window.setTimeout("loadData()", 10000);
$(".refresh").click(function(){
window.clearTimeout(autoRefresh);
loadData();
});
});
function loadData()
{
$.get("ajax.php", function(result){
$("#div").html(result).fadeIn('slow');
});
autoRefresh = window.setTimeout("loadData()", 10000);
}
</script>
<div id="div"></div>
<a href="" onclick="return false;" class="refresh">refresh</a>
good luck,
Feras Jobeir