Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools HTTP Basics Introduction to HTTP HTTP Request Format

How would I make a http request on a regular html page? Where would it go?

I am trying to do this in a real life situation. I want to successfully get a response from another server.

1 Answer

Steven Parker
Steven Parker
231,236 Points

Two of the most common ways to make requests from an HTML page are by using links ("a" elements, also known as "anchors") and forms ("form" elements). Links make GET requests, and the response replaces the page currently being shown. With forms, you can specify what kind of request to make, and the results will depend on how the server is programmed to respond.

Examples:

<body>
<!-- this makes a GET request to google.com -->
<a href="//google.com">Go to Google</a>

<!-- this makes a POST request to a specific page on the same site -->
<form action="some_form_page.php" method="post">Form fields would go here</form>
</body>

You'll see more details on both of these later in the course.