# \[AJAX\] - Simple Form Validation

**URL:** <https://forum.kirupa.com/t/ajax-simple-form-validation/241273>\
**Category:** programming\
**Created:** [October 11, 2007, 6:11pm UTC](https://forum.kirupa.com/t/ajax-simple-form-validation/241273 "2007-10-11T18:11:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [October 11, 2007, 6:11pm UTC](https://forum.kirupa.com/t/ajax-simple-form-validation/241273/1 "2007-10-11T18:11:32Z")

</div>

This is my first attempt at coding AJAX and what should be simple isn’t. I’m using w3school’s example but I want to pass the form information to an ASP page then give a response based on the results. I’m wondering why my form values aren’t being passed to the ASP script.

```auto

<html>
<body>

<script type="text/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.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","ajax_respond.asp",true);
    xmlHttp.send(null);
  }
</script>

<form name="myForm" method ="post">
Name: <input type="text" name="name" />
Time: <input type="text" name="time" />
<input type="button" value = "submit" onclick="ajaxFunction();"/>
</form>

</body>
</html>

```

And for the validate script

```auto

<%
response.expires=-1
name = Request.Form("name")

if name <> "" then
    response.write(time)
else
    response.write "No name provided"
End if

%>

```

Now shouldn’t whatever is in my form be passed to the validation script? I don’t understand, I’m looking through tutorials and such but there isn’t a clear definition on how to pass a form value to the script.

Thanks for any help.
