473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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

13
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 1415
ronverdonk
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
Tami
13
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
iam_clint
1,208 Expert 1GB
Yes this can be done.
Dec 4 '06 #4
Tami
13
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">
<head>

<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<title>test</title>
<style type="text/css">
</style>
<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) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}

xmlhttp.open("GET", "test.php",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.responseText)
}
}
xmlhttp.send(null)
</script>
</head>
<body>
<div></div>
</body>
</html>
Dec 10 '06 #5

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

Similar topics

3
by: The Magpie | last post by:
As I am sure you've all noticed, the group seems to be spending more and more time answering more and more questions from more and more people about aspects of AJAX and XhtmlHTTPRequest. There is...
3
by: Motion Musso aka: Sathia | last post by:
function up(bpid) { image = document.getElementById('up_'+bpid); image.setAttribute('SRC','/templates/images/yespulse.gif') up_down('/up_down.php?bpid=' + bpid + '&action=up'); ...
27
by: David Golightly | last post by:
This is just a quick poll for all you web devs out there: What browsers do you test on/are concerned about compatibility with? Obviously, you're going to test on current-generation browsers such...
0
by: =?Utf-8?B?QWxwZXIgQUtDQVlPWg==?= | last post by:
Hello, First of all I wish you a good day. My help request is about .NET asynchrounus socket communication. I have developed Server-Client Windows Forms .NET applications in VC++ .NET v2003. I...
1
by: mark4asp | last post by:
How do I connect to my application via http://localhost/..., using IIS. I've developed an application via the File System (using the VS Web server). When I deploy it I change the...
6
by: Richard Maher | last post by:
Hi, Now that I am aware that JS on a page in Frame A can directly call a function on a page in Frame B, I no longer have to continue with my frameB.location.reload() fudge in order to get some...
5
by: Darin | last post by:
This is going to be pretty vague. Our software was using the 1.1 version of the .NET framework and things were fine. In March we upgraded to using the 2.0 framework, and the visual studio 2005....
1
by: jobs | last post by:
I am able to access 9i and 10g Oracle DBs from other clients on my pc - sqlplus, PLSQL Developer, etc. As a simple test I just wanted to connect and access the same oracle DBs through ASP.NET on...
3
by: smartic | last post by:
how can i make the ajax code keep connecting until it gets data from the server ,in my example i'm using ajax and php in simple chat baord to get new messages from the database and send the new...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.