troubleshooting Question

AJAX response returns the same value only requesting current date time

Avatar of n2alexan
n2alexan asked on
JavaScriptASP.NETVisual Basic.NET
3 Comments1 Solution607 ViewsLast Modified:

I have a very simple webapp that has this index.htm page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
    <title>Untitled Page</title>

    <script type="text/javascript">
            function GetXmlHttp() {      
      var xmlhttp = false;
      if (window.XMLHttpRequest)
            xmlhttp = new XMLHttpRequest();
      else if (window.ActiveXObject)// code for IE
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            catch (e)
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                  } catch (E) {
      return xmlhttp;

            function ajaxFunction(url)
    var xmlHttp = GetXmlHttp();
        document.getElementById("ajaxin").value = document.getElementById("ajaxin").value + '|' + xmlHttp.responseText;

    <input id="Button1" onclick="ajaxFunction('ajax/tracker.aspx');" type="button" value="button" />
    <input id="ajaxin" style="width: 100%; height: 544px" type="text" />

and I use aspx page to write back the date and time

<% Response.Write(DateTime.Now) %>

but every time I press the button I get the same datetime and it's value is not changed, even after 1 minute.
The values of seconds is not updated.

Could someone explain what is happenning here.

Thank you very much,

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros