0

Here's my code it works fine in IE and Chrome, but not in FF

<script type="text/javascript"> function get() { $.post( 'regAuth.php', {usrName: login.usrName.value, password: login.password.value}, function (output) { $('#error').html(output).show(); } ); } </script> 
3
  • 7
    Why does it not work? What errors do you get? Help us to help you. Commented Jan 12, 2012 at 11:53
  • 1
    there's no error..! the query works perfectly fine in chrome.. but when i tried to operate it in FF it does nothing.. if i replace the script content to alert ("xyz") it does works.. but there's problem with $.post function i dont knw what..! :L Commented Jan 12, 2012 at 11:57
  • Have you tried using firebug or something like it to see if there are javascript errors in the background? Or where the problem is breaking down? Commented Jan 13, 2012 at 3:58

1 Answer 1

1

You have to get the input elements properly:

{ usrName: $("input[name='usrName']").val(), password: $("input[name='password']").val() } 

When you have such thing:

login.usrName.value 

Some browsers will go and look for top level element named login (form, frame etc) but you must not depend on such thing.

As you're already using jQuery best practice in my opinion is to use it to read the input values as well.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks.. :D that was great help indeed.. :D

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.