By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,222 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

Simple Ajax for newb

P: n/a
i look for a simple ajax, for a beignner, able to send a request for a
text file and show its content in a <div />
thanxs in advance.

--
une bévue
Oct 2 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
""Une bévue"" <pe*******@laponie.com.invalidwrote in message
news:1h*****************************@laponie.com.i nvalid...
i look for a simple ajax, for a beignner, able to send a request for a
text file and show its content in a <div />
http://marc.theaimsgroup.com/?l=php-...8633625636&w=2
Oct 2 '06 #2

P: n/a
"McKirahan" <Ne**@McKirahan.comwrote in message
news:Y9******************************@comcast.com. ..
""Une bévue"" <pe*******@laponie.com.invalidwrote in message
news:1h*****************************@laponie.com.i nvalid...
i look for a simple ajax, for a beignner, able to send a request for a
text file and show its content in a <div />
Here's an example that allows the user to refresh the time
without reloading the entire page:

<html>
<head>
<title>ajaxTime.htm</title>
<script type="text/javascript">
var i = 0;
function ajaxTime() {
var sURL = "http://tycho.usno.navy.mil/cgi-bin/timer.pl?"+i++;
var oXML = new ActiveXObject("Microsoft.XMLHTTP");
oXML.open("GET",sURL,false);
oXML.send();
var sTXT = oXML.responseText;
sTXT = sTXT.substr(sTXT.indexOf("<H2>"));
sTXT = sTXT.substr(0,sTXT.indexOf("</B>"));
document.getElementById("ajaxTime").innerHTML = sTXT;
}
</script>
</head>
<body>
<a href="javascript:ajaxTime()">What time is it?</a>
<br><br>
<div id="ajaxTime"
style="border:solid 1px black;width:480px;height:240px"
></div>
</body>
</html>

<!--
http://tycho.usno.navy.mil/cgi-bin/timer.pl
returns the following Web page:

<html>
<body>
<TITLE>What time is it?</TITLE>
<H2US Naval Observatory Master Clock Time</H2<H3>
<BR>Oct. 02, 19:04:43 UTC
<BR>Oct. 02, 03:04:43 PM EDT
<BR>Oct. 02, 02:04:43 PM CDT
<BR>Oct. 02, 01:04:43 PM MDT
<BR>Oct. 02, 12:04:43 PM PDT
<BR>Oct. 02, 11:04:43 AM AKDT
<BR>Oct. 02, 09:04:43 AM HAST
</H3></B><P><A HREF="http://tycho.usno.navy.mil">
Time Service Department, US Naval Observatory</A>

</body></html>

the following is extracted and displayed:

<H2US Naval Observatory Master Clock Time</H2<H3>
<BR>Oct. 02, 19:04:43 UTC
<BR>Oct. 02, 03:04:43 PM EDT
<BR>Oct. 02, 02:04:43 PM CDT
<BR>Oct. 02, 01:04:43 PM MDT
<BR>Oct. 02, 12:04:43 PM PDT
<BR>Oct. 02, 11:04:43 AM AKDT
<BR>Oct. 02, 09:04:43 AM HAST
</H3>
-->
Oct 2 '06 #3

P: n/a
McKirahan <Ne**@McKirahan.comwrote:
http://marc.theaimsgroup.com/?l=php-...8633625636&w=2
ok, thanks, i get it !
--
une bévue
Oct 2 '06 #4

P: n/a
"Une bévue" wrote:
i look for a simple ajax, for a beignner, able to send a request for a
text file and show its content in a <div />
http://www.AjaxToolbox.com

I think the interface I've created is quite straight-forward, and there are
a number of examples on the site.

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Oct 2 '06 #5

P: n/a
Matt Kruse <ne********@mattkruse.comwrote:
>
http://www.AjaxToolbox.com

I think the interface I've created is quite straight-forward, and there are
a number of examples on the site.
great, thanks !
--
une bévue
Oct 2 '06 #6

P: n/a
McKirahan <Ne**@McKirahan.comwrote:
Here's an example that allows the user to refresh the time
without reloading the entire page:
fine thanks !
--
une bévue
Oct 2 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.