I am re-developing my website and want to use some Ajax/jQuery in it (so I am learning as I go) and I am not sure if this is possible so that is my first question:
I have a registration form and I would like to know if after the person registering has completed their first and surname and the 2 sections of their postcode if I can use jQuery to run a PHP script to see if they are already registered before waiting for the form to be submitted and running a script then.
I am thinking onkeyup (or similar) after the last field is completed but I don’t know how that would work needing to also use 3 other field values.
If this is possible, can anyone give me any ideas of examples that do this or how I can go about passing all the variables and running the scripts at the correct time.
Even if this is not possible I would like to know please so that I can stop looking for the answer.
Thank you - I have read this before and read it again over the weekend but I am still not sure how to implement the function(s) before the form is submitted.
Thank you - yes I can do the validate part (I haven’t got a problem with that) it is how to pass that information through to an ajax function/script to then run the php to see if they are registered.
Do I create vars from the $_GET elements and pass them through to the url of the php script?
Crating variables from $_GET is okay, but what happens after you’ve checked them is to then just output a value, such as “valid” or “invalid”
That value that you output from the php script is returned back to the web page as data. The ajax request fetches that data, so that your script can then take appropriate action based on that value.
With the validation script, if it’s an invalid value you would then trigger the validation process for an invalid value.