jQuery in Action
Making GET and POST requests
233
{ style: styleValue }
);
})
.change();
});
</script>
</head>
<body id="bootCloset1">
<img id="banner" src="boot.closet.branding.png"/>
<form action="" id="orderForm">
<div id="detailFormContainer">
<h1>Choose your boots</h1>
<div>
<label>Please choose a style:</label><br/>
<select id="styleDropdown">
<option value="">Please choose a boot style</option>
<option value="7177382">
Caterpillar Tradesman Work Boot</option>
<option value="7269643">Caterpillar Logger Boot</option>
<option value="7141832">Chippewa 17" Engineer Boot</option>
<option value="7141833">Chippewa 17" Snakeproof Boot</option>
<option value="7173656">Chippewa 11" Engineer Boot</option>
<option value="7141922">Chippewa Harness Boot</option>
<option value="7141730">Danner Foreman Pro Work Boot</option>
<option value="7257914">Danner Grouse GTX Boot</option>
</select>
</div>
<div id="detailsDisplay"></div>
</div>
</form>
</body>
</html>
The
load()
command is tremendously useful when we want to grab a fragment
of
HTML
to stuff into the content of an element (or set of elements). But there
may be times when we either want more control over how the Ajax request gets
made, or we need to do something more esoteric with the returned data in the
response body.
made, or we need to do something more esoteric with the returned data in the
response body.
Let's continue our investigation of what jQuery has to offer for these more
complex situations.
8.3 Making GET and POST requests
The
load()
command makes either a
GET
or a
POST
request, depending on
whether it's called with request data, but sometimes we want to have a bit more