Cannot call asp page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mathewgk80
    New Member
    • Sep 2007
    • 103

    #1

    Cannot call asp page

    Hi all,

    My html source is:
    timeAj.html
    [CODE=html]<html>
    <body>
    <script type="text/javascript">[/code]
    [code=javascript]function ajaxFunction()
    { var xmlHttp;
    try
    {
    // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest( );
    }
    catch (e)
    {
    // Internet Explorer
    try
    {
    xmlHttp=new ActiveXObject(" Msxml2.XMLHTTP" );
    }
    catch (e)
    {
    try
    {
    xmlHttp=new ActiveXObject(" Microsoft.XMLHT TP");
    }

    catch (e)
    {
    alert("Your browser does not support AJAX!");
    return false;

    }
    }
    }
    xmlHttp.onready statechange=fun ction()
    {
    if(xmlHttp.read yState==4)
    {
    document.myForm .time.value=xml Http.responseTe xt;
    }
    }
    xmlHttp.open("G ET","time.asp", true);
    xmlHttp.send(nu ll);
    }[/code]
    [code=html]</script>
    <form name="myForm">
    Name: <input type="text"
    onkeyup="ajaxFu nction();" name="username" />
    Time: <input type="text" name="time" />
    </form>
    </body>
    </html>[/code]

    and asp page is:
    time.asp
    ...........
    [CODE=asp]<%
    response.expire s=-1
    response.write( time)
    %>
    [/CODE]
    But i cant call.time.asp into the main page...

    I am new in Ajax...

    Please help me...

    Regards,
    Mathew
    Last edited by acoder; Oct 26 '07, 08:38 AM. Reason: Added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    If your code is as you have it typed here, look at the colours of the syntax highlighting. The XMLHttpRequest call has been commented out.

    Remember to use code tags when posting code. As a full member, you should know that by now.

    Comment

    • mathewgk80
      New Member
      • Sep 2007
      • 103

      #3
      Originally posted by acoder
      If your code is as you have it typed here, look at the colours of the syntax highlighting. The XMLHttpRequest call has been commented out.

      Remember to use code tags when posting code. As a full member, you should know that by now.
      HI,
      I have changed the previous html code into the following..

      timeAj.html
      ............... ..

      [HTML]<html>
      <body>
      <script type="text/javascript">
      [/HTML]
      [CODE=javascript]function ajaxFunction()
      {

      var xmlHttp;

      try

      {

      xmlHttp=new XMLHttpRequest( );
      }
      catch (e)
      {
      try
      {
      xmlHttp=new ActiveXObject(" Msxml2.XMLHTTP" );
      }
      catch(e)
      {
      try
      {
      xmlHttp=new ActiveXObject(" Microsoft.XMLHT TP");
      }
      catch(e)
      {
      alert("Your browser does not support AJAX!");

      return false;

      }
      }
      }
      xmlHttp.onready statechange=fun ction()
      {
      if(xmlHttp.read yState==4)
      {
      document.myForm .time.value=xml Http.responseTe xt;
      }
      }
      xmlHttp.open("G ET","time.asp", true);
      xmlHttp.send(nu ll);
      }[/CODE]
      [HTML]</script>
      <form name="myForm">
      Name: <input type="text"
      onkeyup="ajaxFu nction();" name="username" />
      Time: <input type="text" name="time" />
      </form></body>
      </html>
      [/HTML]
      when i enter some value in the first textbox ie,to the Name field,
      the Time field displays '<%' .. I dont know how to display the current time..
      Please help me...

      Regards,
      Mathew
      Last edited by acoder; Oct 29 '07, 09:46 AM. Reason: Added code tags

      Comment

      • mathewgk80
        New Member
        • Sep 2007
        • 103

        #4
        hi,
        I have written time.asp page in the notepad and save the file in the same folder where timeAj.html saved...

        Please help me..

        Originally posted by mathewgk80
        HI,
        I have changed the previous html code into the following..

        timeAj.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.XMLHT TP");
        }
        catch(e)
        {
        alert("Your browser does not support AJAX!");

        return false;

        }
        }
        }
        xmlHttp.onready statechange=fun ction()
        {
        if(xmlHttp.read yState==4)
        {
        document.myForm .time.value=xml Http.responseTe xt;
        }
        }
        xmlHttp.open("G ET","time.asp", true);
        xmlHttp.send(nu ll);
        }
        </script>
        <form name="myForm">
        Name: <input type="text"
        onkeyup="ajaxFu nction();" name="username" />
        Time: <input type="text" name="time" />
        </form></body>
        </html>

        when i enter some value in the first textbox ie,to the Name field,
        the Time field displays '<%' .. I dont know how to display the current time..
        Please help me...

        Regards,
        Mathew

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          I don't want to remind you again. Use code tags when posting code.

          Try running the ASP page without Ajax. Does that work?

          Comment

          Working...