/    Sign up×
Community /Pin to ProfileBookmark

javascript degrading

I’m working on a new site, and I plan on using jquery for form processing (ajax, to prevent window reloading). I’d like to code it such that if javascript is disabled the forms still work, although with page refreshes. I’m just not sure how to accomplish this. I haven’t started coding the JS yet, so I’m just looking for a little insight on what I will have to do to make this work.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@aj_nscOct 05.2009 — Well, you've got good timing. if you haven't started coding the JS yet, don't! If you want your forms to work without JS, then build them as if JS didn't exist. Once you're finished and they work fine, then add your JS for the interactivity that you want.

It's really just that simple.

I'm assuming you already know how to process forms with a serverside language (otherwise, how could you use ajax?), so this really shouldn't be that difficult for you.
Copy linkTweet thisAlerts:
@TheCowGoesMooauthorOct 06.2009 — The part that I am not sure about is telling javascript to catch the form submission rather than submit to the php files for processing. Normally when I'm working with jquery I just bind a function to the click event of a button.
Copy linkTweet thisAlerts:
@criterion9Oct 06.2009 — There is a wonderful trigger called onsubmit for form tags.
Copy linkTweet thisAlerts:
@TheCowGoesMooauthorOct 06.2009 — <(^-^<) <(^-^)> (>^-^)>

Thanks, that will do it.
×

Success!

Help @TheCowGoesMoo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...