5.21. Another test driveAdd the line of JavaScript that sets the "Content-Type" request header in pizza.js, and save your JavaScript. Then load pizza.html in your web browser, and try to enter an order again. The pizza order form is working again... ...but this time, the order is being sent to the server using a POST request. No big orders are gonna get lost with POST! Congratulations... You've saved Alex's butt once again. Pizza's on us! But you still haven't told me what the actual maximum length of the request URL in a GET request is. Hello? It's browser-dependent Each browser treats URLs differently. So the maximum request URL length is different on each browser. Opera, Internet Explorer, Safari... it just depends on which browser customers are using. But it's really small, I guess. Like, just 50 or 75 characters long? Well, it's not that small... Remember, each browser is different. But, for example it's about 2,000 characters on Internet Explorer... that's a good rule of thumb to use for other browsers, too. Did you say two-THOUSAND? Are you kidding me? What are we expecting here, Schwarzenegger is gonna order pizza for the entire state of California? Come on... this is just ridiculous! Hmmm.... well... umm.... OK, you got us. There are probably not going to be a lot of times when the customer's address, phone number, and pizza order are longer than 2,000 characters... even when it's Super Bowl party time. But there are still good reasons to use POST requests...
I gotta tell you, you've saved my butt again. Customers are happy, I'm getting massive tips, and my boss is just going on and on about Ajax.
Take a look at the new POST version of Break Neck Pizza 60 Second Review
|