Browser Password Save with jquery form submit

We need to be able to allow users to save their login information on form submission.    The form submission process is handled by jquery.     If we just use an empty  <form method="post" action="" id="login_form"></form> around the form fields, it works just fine in Firefox but IE just returns to the login page without showing that the form has processed successfully - which is has because the header now shows the user's name, etc.    Is there something I can do to force IE to ignore the actual submission??
digitalwiseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
Yes, don't attach the jQuery to a submit button but just to a button

Please show the jQuery where you bind the action
digitalwiseAuthor Commented:
We are using an image tag - not a submit button - <input type="image" src="../images/footerlogin.jpg" ALT="Submit" border="0" onmouseover="this.src = '../images/footerlogin_over.jpg';" onmouseout="this.src = '../images/footerlogin.jpg';" id="btnLogin" />.    
$(document).ready( function() {
	//attach event handlers
	$("#btnLogin").click( function() { login(); });
	$("#txtUser").focus();
	
	//populate from cookie (remember me checkbox..)?
});

function login() {

	var login = $("#txtUser").val();
	var pwd = $("#txtPwd").val();
	$.post("main.php", { action: 'login', login: login, pwd: pwd }, function(data) {
		if ( data.substr( 0, 5 ) == 'Error' ) {
			$("#errMsg").html( data.substr( 7 ) );
		} else {
			//set cookie
			data=data.split(',');

			createCookie( 'user', login, .5 );
			createCookie( 'companyName', data[0], .5);
           createCookie( 'nomin', data[1], .5);

			//createCookie( 'companyName', data, .5);
			//redirect to page they were trying to access
			window.location = 'index.html';
			
		}
	});
}

Open in new window

Michel PlungjanIT ExpertCommented:
that is ALSO a submit.

Use a button or an image

<button id="btnLogin"><img src="login.jpg"/></button>

or
<img id="btnLogin" src="login.jpg"/>

or best (since it does not stop the user from submitting if javascript is disabled: Simply have a normal form with userid and password. and set the cookie on the server

It does not make much sense in using jQuery so heavily that a user cannot even login to your site unless javascript is enabled


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
digitalwiseAuthor Commented:
Ah - thank you!    I inherited this site - didn't do any of the coding - I completely agree with the absurdity of the coding.  
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JScript

From novice to tech pro — start learning today.