473,320 Members | 1,920 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,320 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 3271
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: 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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.