If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Problem 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.

That's not a good selector, I think. It should probably look something like:

Code:

$("form [name='loginForm']").submit(function () {

That's for problem #2. However, if it's correct, then the submit handler should have never fired on form submission. That means the backside should never have been called in the first place and no data would have been passed.

Is there a way to send JQuery AJAX variables to the server side script using POST instead of GET?

Yes. That's what $.post() is for. Have you dropped in some alert()s for debugging? Check to make sure you're actually getting into the submit handler and that you're getting the data there. Also, the return false; should be outside of the $.post function but inside the submit handler.

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.