![]() |
JQuery: Trying to make a Login Form
I realize there are lots of tutorials posted on how to make a JQ login form. Unfortunately none that i have googled address the two problems I am having:
My JS Code which is in the head of my login form: Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>My login form: Code:
<form action="login.php" method="post" name="loginForm">Code:
// mySQL username/password connection code omitted for obvious reasonsProblem 1: Unable to pass the username and password to the ajax file Despite using the .post func in JS I am unable to pass the values of the username and password to the serverside ajax file: "ajax_logincheck.php". You will notce that in my .post() I use two different ways to submit the parameters: radusername:$('[name=radusername]').val(),radpassword:$('#radpasswordfield').val() I have tried keeping them the same, trading them around and nothing seems to work. Problem 2: Form still submits oldschool even if JS is enabled I have the form set up so that it still submits for users who don't have JS enabled browsers. Problem is, even though I use "return false;" in my $.post() the form still submits and the page refreshes even though my browser has JS enabled. Can someone please give me advise? thanks |
Code:
$("loginForm").submit(function () {Code:
$("form [name='loginForm']").submit(function () {Try the selector change and see what happens. |
thanks tomws for answering but it didn't work
it would appear that the problem is simple: it only works with the method: GET, not POST the problem then is that the person's username and password end up in the URL. Is there a way to send JQuery AJAX variables to the server side script using POST instead of GET? |
Quote:
I just noticed, you're passing the data in JSON format. If you want to use JSON, you'll need to convert on the backside before accessing the data. See json_decode. If not interested in JSON, remove that last argument from the $.post function. |
| All times are GMT +1. The time now is 02:29 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.