473,228 Members | 1,617 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,228 software developers and data experts.

W3Schools Ajax time example doesn't work in my system

18
Hello,

This is an example from w3schools. I tried to execute this in my system, but it does not work.

My file is testajax.html

Expand|Select|Wrap|Line Numbers
  1. text
  2.  
  3. <html>
  4. <body>
  5.  
  6. <script type="text/javascript">
  7. function ajaxFunction()
  8. {
  9. var xmlHttp;
  10. try
  11.   {
  12.   // Firefox, Opera 8.0+, Safari
  13.   xmlHttp=new XMLHttpRequest();
  14.   }
  15. catch (e)
  16.   {
  17.   // Internet Explorer
  18.   try
  19.     {
  20.     xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  21.     }
  22.   catch (e)
  23.     {
  24.     try
  25.       {
  26.       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  27.       }
  28.     catch (e)
  29.       {
  30.       alert("Your browser does not support AJAX!");
  31.       return false;
  32.       }
  33.     }
  34.   }
  35.   xmlHttp.onreadystatechange=function()
  36.     {
  37.     if(xmlHttp.readyState==4)
  38.       {
  39.       document.myForm.time.value=xmlHttp.responseText;
  40.       }
  41.     }
  42.   xmlHttp.open("GET","time.asp",true);
  43.   xmlHttp.send(null);
  44.   }
  45. </script>
  46.  
  47. <form name="myForm">
  48. Name: <input type="text" onkeyup="ajaxFunction();" name="username" />
  49. Time: <input type="text" name="time" />
  50. </form>
  51.  
  52. </body>
  53. </html>
  54.  
  55.  

///////////////////////////////////////

another file time.asp

<%
response.expires=-1
response.write(time)
%>

//////////////////////////

I wrote exactly like this but it does not give time wehn I execute...

Please let me know what is the problem
Jun 20 '08 #1
3 3264
acoder
16,027 Expert Mod 8TB
Have you checked that the ASP file returns the correct output? Test by running the ASP file without using Ajax.
Jun 20 '08 #2
acoder
16,027 Expert Mod 8TB
I've split this from the other thread since it's a different problem.

I've deleted some useless posts that appeared under your name. Can you confirm if that was someone else posting?
Jun 20 '08 #3
dmjpro
2,476 2GB
@vpriya6
You are checking only readyState but not the statusCode as well.
Concentrate on Acoder's point.
See don't you get any updated value into your targeted Text Box(time)?
May 4 '09 #4

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

Similar topics

49
by: Aidan | last post by:
I rely heavily on MSDN for documentation when it comes to HTML/DHTML/JavaScript/CSS but as a result I often have problems getting my stuff to work in Netscape/Mozilla/Firefox. I like the MSDN...
8
by: needin4mation | last post by:
I understand this is a asp.net group, but thought I would post this here for comments. I admit I have used this post in another group, but it has less traffic. Here's to hoping I'm just blind to...
3
by: Tony | last post by:
I've done a fair bit of searching on this, but I want to be certain about what I've found - so here goes with a long example and three questions: For clarity, let me give an example (a number of...
7
by: Ivan Marsh | last post by:
Hey Folks, I'm having a heck of a time wrapping mind around AJAX. Anyone know of a simple, straight-forward example for pulling a simple query from mysql with PHP using AJAX? As I...
31
by: Tony | last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET distribution - I'm pretty concerned about this. Does anyone know if this is the same "prototype.js" that is not well-liked...
25
by: meltedown | last post by:
This is supposed ot be an example: http://www.ajaxtutorial.net/index.php/2006/11/30/simple-ajax-using-prototype-part-2/ It says : This example is probably the simplest example you will ever...
17
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);"...
6
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
7
by: Joe | last post by:
I added some ajax to my asp.net web site and will Ajax just doesn't seem to work. Does Any one PLEASE have any ideas on why Ajax doesn't work on Apache 2.2.6 w/asp.net 2.0
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.