473,666 Members | 2,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

13 New Member
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 1431
ronverdonk
4,258 Recognized Expert Specialist
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 New Member
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 Recognized Expert Top Contributor
Yes this can be done.
Dec 4 '06 #4
Tami
13 New Member
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.c om/test.js"></script>
<script type="text/javascript">
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_vers ion >= 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.XMLHT TP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest! ='undefined') {
try {
xmlhttp = new XMLHttpRequest( );
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRe quest) {
try {
xmlhttp = window.createRe quest();
} catch (e) {
xmlhttp=false;
}
}

xmlhttp.open("G ET", "test.php",true );
xmlhttp.onready statechange=fun ction() {
if (xmlhttp.readyS tate==4) {
alert(xmlhttp.r esponseText)
}
}
xmlhttp.send(nu ll)
</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
1572
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 obviously a problem out there in need of an answer and people seem to be coming here to get that answer. So - is there a better way we can give it? One obvious possibility is that we could provide an explicitly Open Source and "black box"...
3
1609
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'); image.setAttribute('SRC','/templates/images/rated_up.gif')
27
2724
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 as IE6, IE7, Firefox 1.5/2, Opera 8/9, Safari 2, etc. How old must a browser be before you stop worrying about it? Anybody here still test on IE4? Thanks,
0
2593
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 have several problems re-establishin connection between peers. Below are my problem cases after closing of the first successfull communication; #1) I re-start the Server to accept connection requests. While it is waiting, I run the Client. It is...
1
1935
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 <appSettingsFrom MyAppConnString_localhost to MyAppConnString_live (see config settings below). Up to now connections have worked fine.
6
1941
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 code to run in B's context. This is fantastic news, and I'm having a ball! But before running off with all my convert's zeal and converting all my <script src="common.js"copy-books to direct parent.frame.function() calls I'd like to pause for a...
5
1134
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. Now, on the same hardware and program, everything is slower, especially when connecting to SQL. Has anyone seen anythign like this? Darin
1
2371
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 my same client ... my web config connection entry looks like this (somebody elsewhere said this was working for them): <add name="pp2" connectionString="user id=xxx;password=xxx;data
3
1258
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 message to the page by ajax how can i do that ?
0
8448
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8783
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.