469,601 Members | 2,406 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,601 developers. It's quick & easy.

Connecting source code to ajax and commands elsewhere after so much time

Hello, I could use some advice on the best way to connect to some php in my source code using ajax. So that the php will re-execute after so much time with a script elsewhere on the server. Please let me know, thanks. Tami
Dec 3 '06 #1
4 1238
4,258 Expert 4TB
Have a look at some of the demos in the Ajax scripts .
There are some scripts in there (esp. RSS type) that use JS timers to refresh the content after every x seconds. You'll probably find something useful there.

Ronald :cool:
Dec 3 '06 #2
Hello, can ajax connect to the server for a server side script function only and NOT a page?

For instance lets say I want part of the main page to have a refresh without a full refresh every so often. There is a function on the server that executes another after so much time. Can the ajax connect to it? Thank you very much.
Dec 4 '06 #3
1,208 Expert 1GB
Yes this can be done.
Dec 4 '06 #4
Hello, the following is a simple http request that just shows the source code in an alert when you put test.php in the browser, just to show the http request is working. How can I make the exact same http request re-execute after so much time? I tried putting a javascript setTimeout on it but seem to be doing it wrong. How would a setTimeout be attached to this to make the request call again? Or is there a better way than a setTimeout? I really need to get this working. Hope someone can help. Thank you very much.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<style type="text/css">
<script type="text/javascript" src="http://www.mooonbaby.com/test.js"></script>
<script type="text/javascript">
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {

xmlhttp.open("GET", "test.php",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
Dec 10 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by The Magpie | last post: by
3 posts views Thread by Motion Musso aka: Sathia | last post: by
27 posts views Thread by David Golightly | last post: by
reply views Thread by =?Utf-8?B?QWxwZXIgQUtDQVlPWg==?= | last post: by
1 post views Thread by jobs | last post: by
3 posts views Thread by smartic | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.