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


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
  3. <html>
  4. <body>
  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>
  47. <form name="myForm">
  48. Name: <input type="text" onkeyup="ajaxFunction();" name="username" />
  49. Time: <input type="text" name="time" />
  50. </form>
  52. </body>
  53. </html>


another file time.asp



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
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
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
2,476 2GB
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

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...
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...
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...
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...
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...
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...
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);"...
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...
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
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...
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...
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...
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...
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...
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...
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...
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"....
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...
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.