Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

Check if javascript works

Javascript coding ..

Moderators: macek, egami, gesf

Check if javascript works

Postby faust » Tue May 15, 2012 7:05 am

My problem: I have 2 forms that use ajax - login and register. Everything works, if the user makes an error - an error popup shows. So my question is: is there a way to determine if the ajax request succeeded or something broke or maybe the user disabled his browsers js? If something like that occurs to submit the form the traditional way without ajax requests? Is there a way to check this?
faust
New php-forum User
New php-forum User
 
Posts: 109
Joined: Thu May 03, 2012 7:22 am

Re: Check if javascript works

Postby minimihi » Fri May 18, 2012 2:27 pm

You could use HTML <noscript> Tag to notify user to enable JavaScript. If JavaScript is not supported, only option (I think) would be to redirect user to page without JavaScript
like:
Code: Select all
<noscript>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://www.some.org/form_without_JS.html">
</noscript>


As for AJAX (with jQuery). To check what happened with connection, you could use complete(), error() or success() functions.
jQuery.ajax()
In case it fails, you could submit form with JavaScript.
User avatar
minimihi
New php-forum User
New php-forum User
 
Posts: 238
Joined: Sat Apr 14, 2012 11:57 am
Location: Vilnius, Lithuania

Re: Check if javascript works

Postby faust » Mon May 21, 2012 7:13 am

Thanks, thats what I was going to do :)
faust
New php-forum User
New php-forum User
 
Posts: 109
Joined: Thu May 03, 2012 7:22 am


Return to JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron