views:

84

answers:

4

I'm trying to polish my web programming skills with the unobtrusive yet extremely helpful polish I find on many sites. Stackoverflow.com, for one. When I ask a question, the page submits the question, and my browser reloads itself displaying my question. My back button works like it really should, not asking me (from a user's perspective) the scary question of "In order to display this page we need to resend your request to the server. Do you want to do that?"

In addition, after submitting the question, if I hit "refresh" it also doesn't call another form submit.

Is there a site that lists out tricks like this? I'm assuming that I'm going to have to rethink the standard display/submit/display cycle that I use most often, but I'm very willing to learn some new techniques.

Anyone have any pointers for me?

EDIT: I figured I'd say this here instead of in individual comments. Firebug is indeed a fantastic tool, and I use it all the time. I'm using jQuery more and more these days, but I'd hardly call myself proficient at it. I'd love to use Firebug to track what happens when asking questions, commenting, etc, but I don't want to abuse the site for the purposes of learning. ;)

A: 

I don't know of one single source for info like this, better than this site at least. I think that with web programming there are simply too many ways to do something, sometimes the CMS makes things smooth, sometimes a library, sometimes hand written code.

I've found focusing on a narrower set of technologies allows me to build a personal set of "best known methods" easier.

Art
+6  A: 

A lot of what you're referring to is due to the increasing use of AJAX throughout the internet. Forms are submitted using AJAX behind the scenes and the page is updated dynamically without actually reloading. Since it wasn't submitted via a traditional form, there is no POST request on the page, which is what causes the re-submit you're referring to. Look into Unobtrusive Javascript, Behavioral Separation and use jQuery and you'll find how easy it is to accomplish this type of functionality.

Shawn Steward
I'd never heard the term Unobtrusive Javascript. Funny how I even used the word in my question. Thanks for the pointers! Hopefully others will come in and add some other things. I did find information on the PRG design pattern which is a part of what I'm looking for, in case anyone else reads this.
Matt Dawdy
A: 

It is always useful to open the network tab of firebug to see what's going on in the sites that catch your attention.

nacmartin
A: 

There is alot of ajax being done to add a slick non reloading layer to your site. But if you do not want to go that deep into ajax there is also the simple method of redirecting the url after you have submited the form. This will mean the browser can be refreshed etc and it will not resubmit.

As for a single site listing these kinds of recommendations, I do not know of one off hand but would be interested to see if there are any good ones people can recommend

Matthew Hood