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

Error in the ajax program

40
Hey Frnds..

I have made a program in which the user will enter the name and the time will automatically display in the other text box. But the problem it is not showing the output as needed. It is displaying the same text as written in the asp file.
Following the code.

[HTML]
<html>
<body>
<script type="text/javascript">

function ajaxFunction()
{
var xmlHttp;
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your Browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open("GET","time.asp",true);
xmlHttp.send(null);
}
</script>

<form name="myForm">
Name: <input type="text" onkeydown="ajaxFunction();" name="username" />
Time: <input type="text" name="time" />
</form>
</body>
</html>[/HTML]

ASP file

Expand|Select|Wrap|Line Numbers
  1. <%
  2. response.write(time)
  3. %>
Jan 25 '07 #1
1 1074
acoder
16,027 Expert Mod 8TB
Your AJAX is obviously working because it is obtaining the output from the ASP file, but you are getting the wrong output. I think that this is an ASP problem rather than an AJAX one. Have you tried running your ASP code without AJAX, i.e. by directly accessing time.asp in the browser?
Jan 25 '07 #2

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

Similar topics

0
by: melledge | last post by:
Ajax Developers' Day to Kick Off XTech 2006 Conference Industry experts offer insight into next generation of the Web ALEXANDRIA, VIRGINIA, USA - April 25, 2006 - In response to the rapidly...
1
by: monudjn | last post by:
Hi I am implementing ajax in portal. Using ajax i am able to updating the content of portlets asynchronously. However i am facing a problem The Problem: While submitting the form i am getting...
4
by: pbd22 | last post by:
Hi. I have an ajax question. I am wondering if it is possible to get the response from a method within a given page, and that function alone? Traditionally, I have been getting the response...
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
3
by: =?Utf-8?B?bWNpbWFnaW5n?= | last post by:
We have recently applied AJAX to our web site, nothing particularly fancy, just some update panel, progress images and collapsible panels, just the basics to improve the user experience. The...
2
by: Mike P | last post by:
Whenever I startup an Ajax Control Toolkit Website I get the following error: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,...
2
by: germ | last post by:
doing a simple page webmethod call an a page via PageMethods works fine in ie7 & opera9 the same call on firefox ( and I assume netscape ) generates the following error : Error: " nsresult:...
2
by: action | last post by:
Hi, I am new to AJAX and need some help. Here is my situation. We moved a project from one directory (website.com/program/) to another (website.com/). When I went to run the project, I am given...
2
by: kpg | last post by:
I have an AJAX enabled web service consumed by an AJAX enabled web app, given a zip code it returns the city and state. Tested the web service, it works fine. I created a services collection...
9
by: Trapulo | last post by:
Hello, with ASP.NET 2.0 Ajax every unexpected error is managed client-side with a popup that reports the error to the user. In ASP.NET 3.5 this behavor has been changed: how can I have a similar...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
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,...
0
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...

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.