About Me

Friday, 20 April 2012

Ajax - Creating an HTML Form

Ajax - Creating an HTML Form

Before we can start getting to the exciting new stuff, we must first make a standard HTML form (no submit button though!). This form will be spiced up in later with a hint of Ajax, but for now let's just make a solid, basic HTML form with a couple inputs.

Ajax - Do You Have the Time?

To keep this Ajax easy to understand, we are going to be creating an HTML form that has two text fields: name and time. The name field will be filled in by the user, while the time field will be filled in using Ajax.
Below is the HTML code for your "order.html" webpage. If you would like to refresh your knowledge of forms, then check out our HTML forms lesson.

order.html HTML Code:

<html>
<body>

<form name='myForm'>
Name: <input type='text' name='username' /> <br />
Time: <input type='text' name='time' />
</form>

</body>
</html>
Save this file as "order.html"

Ajax - Where's the Submit Button?

That's the great thing about Ajax, you do not need a form submit button to send the user's data to the server. We are going to be using our "Javascript on Steroids" to get and submit data with the server.
Now that we have our HTML form, we can dive deeper into the Ajax jungle and try to discover what we're facing.

0 comments:

Post a Comment