/    Sign up×
Community /Pin to ProfileBookmark

Thought I had it – part of a page reload

Had used script to reload only part of a page. However, tested it in Firefox -> Fine, Safari -> Fine. Internet Explorer on a PC? Reloaded the image once and then stopped.

Any obvious errors?

Have ‘./code.php’ picking a random image from a MySQL database

[CODE]
<script type=”text/javascript”>
function Ajax(){
var xmlHttp;
try{
xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
}
catch (e){
try{
xmlHttp=new ActiveXObject(“Msxml2.XMLHTTP”); // Internet Explorer
}
catch (e){
try{
xmlHttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
catch (e){
alert(“No AJAX!?”);
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById(‘ReloadThis’).innerHTML=xmlHttp.responseText;
setTimeout(‘Ajax()’,4000);
}
}
xmlHttp.open(“GET”,”./code.php”,true);
xmlHttp.send(null);
}
window.onload=function(){
setTimeout(‘Ajax()’,4000);
}
</script>

<div id=”ReloadThis”>
<?php
require(‘./code.php’);
?>
</div> [/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @tholman spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...