1

I'm currently starting a new project and would like to use Ajax (through jQuery) for form submission. What is the best way to handle situations if a user has javascript disabled?

I know this is basic web knowledge so thanks in advance.

THANKS GUYS

Thanks for the help - I managed to find this in another post - sorry for the trouble. I have started a vote to close the question.

heisenberg
  • 9,665
  • 1
  • 30
  • 38
jjNford
  • 5,170
  • 7
  • 40
  • 64

3 Answers3

0

There are a bunch of ways you could do this.

One, which works really well.

Create a div that can cover most of the page. Put a message in this div. When your page loads, use javascript to hide/remove the div. if they don't have javascript enabled the div won't go away.

Just one of many many ways..

Darren Wainwright
  • 30,247
  • 21
  • 76
  • 127
  • I guess I'm looking more for a way to fall back to normal post if the ajax request can't be run because the script is disabled. – jjNford Oct 26 '12 at 18:54
  • I haven't tried this, though have you tried binding a click even to your submit button, disabled javascript on your browser and then tried clicking it? I'm wondering if it will just postback normally as the click event (and it's contained e.preventDefault();) would have been ignored. – Darren Wainwright Oct 26 '12 at 18:58
0

Ignore the nonJS users? ;-)

If you can't ignore them, you should build your complete project with standard forms (i.e. classical php). Later you could add the ajax abilities as a extra feature. In best case the ajax calls trigger the same server functions like the standard forms.

bukart
  • 4,906
  • 2
  • 21
  • 40
0

If your app is absolutely reliant on AJAX, and javascript, then politely inform the user that if they want to use your app, they need to have a modern browser with javascript enabled.

If you can make your app in a way that is not reliant on AJAX (better this way if possible) then have a system of pagination, or whatever fits your specific app, to give as close an experience as possible to the javascript version.

As a rule of thumb, it is better to write apps using server side scripting (to handle persistance securely), to deliver html (universally read by all browsers), using css (that add style to already well formed html), and javascript (for client side interactivity, always as optional extra).

Billy Moon
  • 57,113
  • 24
  • 136
  • 237